CmdID / aws / aws codeartifact
aws codeartifact put-repository-permissions-policy
Sets the resource policy on a repository that specifies permissions to access it. AWS CLI reference
1 example 5 options Its page in the AWS CLI reference
Examples
To attach a permissions policy to a repository
The following put-repository-permissions-policy example attaches a permission policy that is defined in the policy.json file to a repository named test-repo.
aws codeartifact put-repository-permissions-policy --domain test-domain --repository test-repo --policy-document file://PATH/TO/policy.jsonIdentify--domainThe name of the domain containing the repository to set the resource policy on.--repositoryThe name of the repository to set the resource policy on.--policy-documentA valid displayable JSON Aspen policy string to be set as the access control resource policy on the provided repository.Contents of policy.json:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:root"
},
"Action": [
"codeartifact:DescribePackageVersion",
"codeartifact:DescribeRepository",
"codeartifact:GetPackageVersionReadme",
"codeartifact:GetRepositoryEndpoint",
"codeartifact:ListPackages",
"codeartifact:ListPackageVersions",
"codeartifact:ListPackageVersionAssets",
"codeartifact:ListPackageVersionDependencies",
"codeartifact:ReadFromRepository"
],
"Resource": "*"
}
]
}
Its output
{
"policy": {
"resourceArn": "arn:aws:codeartifact:region-id:123456789012:repository/test-domain/test-repo",
"document": "{ ...policy document content...}",
"revision": "MQlyyTQRASRU3HB58gBtSDHXG7Q3hvxxxxxxx="
}
}For more information, see Set a policy in the AWS CodeArtifact User Guide.
Options
--domain-ownerThe 12-digit account number of the Amazon Web Services account that owns the domain.--domainThe name of the domain containing the repository to set the resource policy on.--policy-documentA valid displayable JSON Aspen policy string to be set as the access control resource policy on the provided repository.--policy-revisionSets the revision of the resource policy that specifies permissions to access the repository.--repositoryThe name of the repository to set the resource policy on.