set_premium_repository_policy
async
¶
set_premium_repository_policy(
repository_name: RepositoryName,
policy_text: RepositoryPolicyText,
*,
config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
registry_id: Optional[RegistryId] = None,
force: Optional[ForceFlag] = None,
) -> SetPremiumRepositoryPolicyResponse
Applies a repository policy to the specified premium repository to control access permissions. For more information, see Amazon ECR repository policies in the Amazon Elastic Container Registry Public User Guide.
Parameters:
-
registry_id(Optional[RegistryId], default:None) –The Amazon Web Services account ID that's associated with the public registry that contains the premium repository. If you do not specify a registry, the default public registry is assumed. You can specify only your own account ID. Cross-account access through a repository policy isn't supported for this operation.
-
repository_name(RepositoryName) –The name of the premium repository to receive the policy.
-
policy_text(RepositoryPolicyText) –The JSON repository policy text to apply to the premium repository. For more information, see Amazon ECR repository policies in the Amazon Elastic Container Registry Public User Guide.
-
force(Optional[ForceFlag], default:None) –If the policy that you want to set on a premium repository policy would prevent you from setting another policy in the future, you must force the
SetPremiumRepositoryPolicyoperation. This prevents accidental premium repository lockouts.
Raises:
-
InvalidParameterException–The specified parameter is invalid. Review the available parameters for the API request.
-
LimitExceededException–The operation didn't succeed because it would have exceeded a service limit for your account. For more information, see Amazon ECR Public service quotas in the Amazon Elastic Container Registry Public User Guide.
-
RepositoryNotFoundException–The specified repository can't be found. Check the spelling of the specified repository and ensure that you're performing operations on the correct registry.
-
ServerException–These errors are usually caused by a server-side issue. Retry the request. If it continues to fail, contact Amazon Web Services Support.
-
UnsupportedCommandException–The action isn't supported in this Region. Check that the action is available in the Amazon Web Services Region that you're using, and try again in a supported Region.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To set the policy of a premium repository This example sets a repository policy on the premium repository my-premium-repository.
>>> await client.set_premium_repository_policy(repository_name='my-premium-repository', policy_text='{"Version":"2012-10-17","Statement":[{"Sid":"AllowDescribe","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::123456789012:role/ExampleRole"},"Action":["ecr-public:DescribePremiumRepositories"]}]}')