CodeArtifact - how to download a package using AWS PowerShell

0

I have figured how to download a package from CodeArtifact using AWS CLI but we are very much a PowerShell shop. This is how I tried to download a package using PowerShell:

$buildPackage = Get-CAPackageVersionAsset -Asset MyApp.3.55.31.zip -Domain my-packages -DomainOwner <my-account-id> -Format generic -Namespace my-namespace -Package MyApp -PackageVersion 3.55.31 -Repository my-builds
$buildPackage

That returns an object like this Asset AssetName PackageVersion PackageVersionRevision


Amazon.Runtime.Internal.Util.CachingWrapperStream MyApp.3.55.31.zip 3.55.31 <revision-id>

I've tried to get the package from the Stream but there are too many methods - I just can't see how to do it.

Anyone have experience with this?

질문됨 6달 전237회 조회
1개 답변
0

I played around with downloading from the returned stream and got this to work:

$buildPackage = Get-CAPackageVersionAsset -Asset MyAsset.3.55.98.zip -Domain mydomain -DomainOwner <aws_account_id> -Format generic -Namespace mynamespace -Package MyAsset -PackageVersion 3.55.98 -Repository myrepo

    $ms = New-Object System.IO.MemoryStream
    $buildPackage.Asset.CopyTo($ms)
    $bytes = $ms.ToArray()
    [IO.File]::WriteAllBytes($DownloadPath, $bytes)
답변함 6달 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠