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?

feita há 6 meses237 visualizações
1 Resposta
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)
respondido há 5 meses
profile picture
ESPECIALISTA
avaliado há um mês

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas