CmdID / aws / aws codeartifact
aws codeartifact put-domain-permissions-policy
Sets a resource policy on a domain that specifies permissions to access it. AWS CLI reference
1 example 4 options Its page in the AWS CLI reference
Examples
To attach a permissions policy to a domain
The following put-domain-permissions-policy example attaches a permission policy that is defined in the policy.json file to a domain named test-domain.
aws codeartifact put-domain-permissions-policy --domain test-domain --policy-document file://PATH/TO/policy.jsonIdentify--domainThe name of the domain on which to set the resource policy.--policy-documentA valid displayable JSON Aspen policy string to be set as the access control resource policy on the provided domain.Contents of policy.json:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ContributorPolicy",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:root"
},
"Action": [
"codeartifact:CreateRepository",
"codeartifact:DescribeDomain",
"codeartifact:GetAuthorizationToken",
"codeartifact:GetDomainPermissionsPolicy",
"codeartifact:ListRepositoriesInDomain",
"sts:GetServiceBearerToken"
],
"Resource": "*"
}
]
}
Its output
{
"policy": {
"resourceArn": "arn:aws:codeartifact:region-id:123456789012:domain/test-domain",
"document": "{ ...policy document content...}",
"revision": "MQlyyTQRASRU3HB58gBtSDHXG7Q3hvxxxxxxx="
}
}For more information, see Set a domain 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 on which to set the resource policy.--policy-documentA valid displayable JSON Aspen policy string to be set as the access control resource policy on the provided domain.--policy-revisionThe current revision of the resource policy to be set.