- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateImpersonationRoleCommand
Creates an impersonation role for the given WorkMail organization.
Idempotency ensures that an API request completes no more than one time. With an idempotent request, if the original request completes successfully, any subsequent retries also complete successfully without performing any further actions.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { WorkMailClient, CreateImpersonationRoleCommand } from "@aws-sdk/client-workmail"; // ES Modules import
// const { WorkMailClient, CreateImpersonationRoleCommand } = require("@aws-sdk/client-workmail"); // CommonJS import
const client = new WorkMailClient(config);
const input = { // CreateImpersonationRoleRequest
ClientToken: "STRING_VALUE",
OrganizationId: "STRING_VALUE", // required
Name: "STRING_VALUE", // required
Type: "FULL_ACCESS" || "READ_ONLY", // required
Description: "STRING_VALUE",
Rules: [ // ImpersonationRuleList // required
{ // ImpersonationRule
ImpersonationRuleId: "STRING_VALUE", // required
Name: "STRING_VALUE",
Description: "STRING_VALUE",
Effect: "ALLOW" || "DENY", // required
TargetUsers: [ // TargetUsers
"STRING_VALUE",
],
NotTargetUsers: [
"STRING_VALUE",
],
},
],
};
const command = new CreateImpersonationRoleCommand(input);
const response = await client.send(command);
// { // CreateImpersonationRoleResponse
// ImpersonationRoleId: "STRING_VALUE",
// };
CreateImpersonationRoleCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
Name Required | string | undefined | The name of the new impersonation role. |
OrganizationId Required | string | undefined | The WorkMail organization to create the new impersonation role within. |
Rules Required | ImpersonationRule[] | undefined | The list of rules for the impersonation role. |
Type Required | ImpersonationRoleType | undefined | The impersonation role's type. The available impersonation role types are |
ClientToken | string | undefined | The idempotency token for the client request. |
Description | string | undefined | The description of the new impersonation role. |
CreateImpersonationRoleCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
ImpersonationRoleId | string | undefined | The new impersonation role ID. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
EntityNotFoundException | client | The identifier supplied for the user, group, or resource does not exist in your organization. |
EntityStateException | client | You are performing an operation on a user, group, or resource that isn't in the expected state, such as trying to delete an active user. |
InvalidParameterException | client | One or more of the input parameters don't match the service's restrictions. |
LimitExceededException | client | The request exceeds the limit of the resource. |
OrganizationNotFoundException | client | An operation received a valid organization identifier that either doesn't belong or exist in the system. |
OrganizationStateException | client | The organization must have a valid state to perform certain operations on the organization or its members. |
WorkMailServiceException | Base exception class for all service exceptions from WorkMail service. |