Types.ps1xml

<?xml version="1.0" encoding="utf-8" ?>
<Types>
  <Type>
    <Name>Artifactory.Item</Name>
    <Members>
      <ScriptProperty>
        <Name>AbsoluteUri</Name>
        <GetScriptBlock>
            $this.Uri
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>ChildrenCount</Name>
        <GetScriptBlock>
            $this.Children.Length
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>IsTrash</Name>
        <GetScriptBlock>
            $this.Repo -ceq 'auto-trashcan'
        </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Artifactory.ChildItem</Name>
    <Members>
      <ScriptProperty>
        <Name>AbsoluteUri</Name>
        <GetScriptBlock>
            "$($env:ARTIFACTORY_ENDPOINT)/$($this.Path)$($this.Uri)"
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>IsTrash</Name>
        <GetScriptBlock>
            $this.Path.TrimStart('/').StartsWith('auto-trashcan')
        </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Artifactory.Repository</Name>
    <Members>
      <ScriptProperty>
        <Name>Name</Name>
        <GetScriptBlock>
            $this.Key
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>RepoType</Name>
        <GetScriptBlock>
            $($this.Type ?? $this.Rclass).ToLower()
        </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Artifactory.StorageInfo</Name>
    <Members>
      <ScriptProperty>
        <Name>BinariesSummaryFriendly</Name>
        <GetScriptBlock>
            "$($this.BinariesSummary.binariesSize) ($($this.BinariesSummary.binariesCount) items)"
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>FileStoreSummaryFriendly</Name>
        <GetScriptBlock>
            "$($this.FileStoreSummary.usedSpace) of $($this.FileStoreSummary.totalSpace)"
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>RepositoriesSummaryListFriendly</Name>
        <GetScriptBlock>
            $RepoSummary = $this.RepositoriesSummaryList | Where-Object repoKey -eq 'TOTAL' | Select-Object usedSpace, itemsCount
            "$($RepoSummary.usedSpace) ($('{0:N0}' -f $RepoSummary.itemsCount) items)"
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>LargestRepos</Name>
        <GetScriptBlock>
            $Top5 = $this.RepositoriesSummaryList |
                Where-Object repoKey -ne 'TOTAL' |
                ForEach-Object { $_ | Add-Member -NotePropertyName 'SortKey' -NotePropertyValue $($_.percentage -match '[0-9\.]+' | Out-Null; [decimal] $($Matches.Values)) -PassThru } |
                Sort-Object -Descending SortKey |
                Select-Object -First 5 -ExpandProperty repoKey
            $Top5 -join ', '
        </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>RepoCount</Name>
        <GetScriptBlock>
            "$($this.RepositoriesSummaryList.Length)"
        </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
</Types>