putImageRecipePolicy
inline suspend fun ImagebuilderClient.putImageRecipePolicy(crossinline block: PutImageRecipePolicyRequest.Builder.() -> Unit): PutImageRecipePolicyResponse
Applies a policy to an image recipe. The preferred way to share resources is with the RAM API CreateResourceShare. If you use the PutImageRecipePolicy operation instead, you must also call the RAM API PromoteResourceShareCreatedFromPolicy. Otherwise, the resource isn't visible to the principals that it's shared with.
Samples
// The following example applies a resource policy that grants another AWS account permission to view
// the specified image recipe.
val resp = imagebuilderClient.putImageRecipePolicy {
imageRecipeArn = "arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.0.0"
policy = "{\"Version\": \"2012-10-17\", \"Statement\": [{\"Effect\": \"Allow\", \"Principal\": {\"AWS\": \"arn:aws:iam::444455556666:root\"}, \"Action\": [\"imagebuilder:GetImageRecipe\", \"imagebuilder:ListImageRecipes\"], \"Resource\": \"arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.0.0\"}]}"
}Content copied to clipboard