PutResourcePolicyCommand

Attaches a resource-based permission policy to the Amazon Web Services Migration Hub Refactor Spaces environment. The policy must contain the same actions and condition statements as the arn:aws:ram::aws:permission/AWSRAMDefaultPermissionRefactorSpacesEnvironment permission in Resource Access Manager. The policy must not contain new lines or blank lines.

Example Syntax

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

import { MigrationHubRefactorSpacesClient, PutResourcePolicyCommand } from "@aws-sdk/client-migration-hub-refactor-spaces"; // ES Modules import
// const { MigrationHubRefactorSpacesClient, PutResourcePolicyCommand } = require("@aws-sdk/client-migration-hub-refactor-spaces"); // CommonJS import
const client = new MigrationHubRefactorSpacesClient(config);
const input = { // PutResourcePolicyRequest
  ResourceArn: "STRING_VALUE", // required
  Policy: "STRING_VALUE", // required
};
const command = new PutResourcePolicyCommand(input);
const response = await client.send(command);
// {};

PutResourcePolicyCommand Input

See PutResourcePolicyCommandInput for more details

Parameter
Type
Description
Policy
Required
string | undefined

A JSON-formatted string for an Amazon Web Services resource-based policy.

ResourceArn
Required
string | undefined

The Amazon Resource Name (ARN) of the resource to which the policy is being attached.

PutResourcePolicyCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
AccessDeniedException
client

The user does not have sufficient access to perform this action.

InternalServerException
server

An unexpected error occurred while processing the request.

InvalidResourcePolicyException
client

The resource policy is not valid.

ResourceNotFoundException
client

The request references a resource that does not exist.

ThrottlingException
client

Request was denied because the request was throttled.

ValidationException
client

The input does not satisfy the constraints specified by an Amazon Web Service.

MigrationHubRefactorSpacesServiceException
Base exception class for all service exceptions from MigrationHubRefactorSpaces service.