Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AWS CodeArtifact #1650

Open
austoonz opened this issue May 8, 2024 · 0 comments · May be fixed by #1660
Open

Add support for AWS CodeArtifact #1650

austoonz opened this issue May 8, 2024 · 0 comments · May be fixed by #1660

Comments

@austoonz
Copy link

austoonz commented May 8, 2024

Summary of the new feature / enhancement

As a user I want to use AWS CodeArtifact as a NuGet v3 PSResourceGet repository.

Proposed technical implementation details (optional)

AWS CodeArtifact supports NuGet v3. Accordingly, it works as a repository when using PSResourceGet (using this guidance for obtaining nuget credentials), however there are some capabilities that should be unblocked in the PSResourceGet source.

I have made changes to the source locally to trial a few capabilities. FindNameGlobbing and FindNameGlobbingWithTag both seem to work as expected.

Additionally, FindAll should be possible with AWS CodeArtifact as well. Some test code is below that I've used with Invoke-RestMethod to retrieve the the list of all available published packages (with my AccountId hidden). Based on this, the ability to retrieve all resources from an AWS CodeArtifact NuGet v3 feed may also need to be unblocked.

In terms of identifying an AWS CodeArtifact repository, a domain name could be used (similar to identifying JFrog feeds, etc), however it might be more appropriate to have a different method of marking a repository for CodeArtifact. Not all AWS Regions or partitions use the same domain name (eg AWS GovCloud), and using only domain name would prevent this from working in those other partitions.

# Given a CodeArtifact Domain `psrepo`, and a CodeArtifact Repository `psrepo` in the AWS Region `us-west-`:
$domain = 'psrepo'
$region = 'us-west-2'
$accountId = '<hidden>'

$token = Get-CAAuthorizationToken -Domain $domain -Region $region
$cred = [PSCredential]::new('aws', (ConvertTo-SecureString -String $token.AuthorizationToken -AsPlainText -Force))

$baseUri = "https://$domain-$accountId.d.codeartifact.$region.amazonaws.com"

# Find the available resources
(Invoke-RestMethod -Credential $cred -Uri "$baseUri/nuget/psrepo/v3/index.json").Resources

# Perform a base query
(Invoke-RestMethod -Credential $cred -Uri "$baseUri/nuget/psrepo/v3/query").data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants