PutComponentPolicyCommand

Applies a policy to a component. We recommend that you call the RAM API CreateResourceShare  to share resources. If you call the Image Builder API PutComponentPolicy, you must also call the RAM API PromoteResourceShareCreatedFromPolicy  in order for the resource to be visible to all principals with whom the resource is shared.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ImagebuilderClient, PutComponentPolicyCommand } from "@aws-sdk/client-imagebuilder"; // ES Modules import
// const { ImagebuilderClient, PutComponentPolicyCommand } = require("@aws-sdk/client-imagebuilder"); // CommonJS import
const client = new ImagebuilderClient(config);
const input = { // PutComponentPolicyRequest
  componentArn: "STRING_VALUE", // required
  policy: "STRING_VALUE", // required
};
const command = new PutComponentPolicyCommand(input);
const response = await client.send(command);
// { // PutComponentPolicyResponse
//   requestId: "STRING_VALUE",
//   componentArn: "STRING_VALUE",
// };

PutComponentPolicyCommand Input

See PutComponentPolicyCommandInput for more details

Parameter
Type
Description
componentArn
Required
string | undefined

The Amazon Resource Name (ARN) of the component that this policy should be applied to.

policy
Required
string | undefined

The policy to apply.

PutComponentPolicyCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
componentArn
string | undefined

The Amazon Resource Name (ARN) of the component that this policy was applied to.

requestId
string | undefined

The request ID that uniquely identifies this request.

Throws

Name
Fault
Details
CallRateLimitExceededException
client

You have exceeded the permitted request rate for the specific operation.

ClientException
client

These errors are usually caused by a client action, such as using an action or resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying an invalid resource identifier.

ForbiddenException
client

You are not authorized to perform the requested operation.

InvalidParameterValueException
client

The value that you provided for the specified parameter is invalid.

InvalidRequestException
client

You have requested an action that that the service doesn't support.

ResourceNotFoundException
client

At least one of the resources referenced by your request does not exist.

ServiceException
server

This exception is thrown when the service encounters an unrecoverable exception.

ServiceUnavailableException
server

The service is unable to process your request at this time.

ImagebuilderServiceException
Base exception class for all service exceptions from Imagebuilder service.