AWS SDK Version 4 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Creates an IAM role from the specified role template. The new role takes its configuration—including its name, path, trust policy, inline and managed policies, permissions boundary, tags, and maximum session duration—from the role template version that you specify. For more information about roles, see IAM roles in the IAM User Guide.

If the template version defines parameters, use the ReplacementValues parameter to supply the values that the service substitutes into the role during creation.

Note:

This is an asynchronous operation using the standard naming convention for .NET 4.7.2 or higher.

Namespace: Amazon.IdentityManagement
Assembly: AWSSDK.IdentityManagement.dll
Version: 3.x.y.z

Syntax

C#
public virtual Task<AcquireRoleResponse> AcquireRoleAsync(
         AcquireRoleRequest request,
         CancellationToken cancellationToken
)

Parameters

request
Type: Amazon.IdentityManagement.Model.AcquireRoleRequest

Container for the necessary parameters to execute the AcquireRole service method.

cancellationToken
Type: System.Threading.CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Return Value


The response from the AcquireRole service method, as returned by IdentityManagementService.

Exceptions

ExceptionCondition
ConcurrentModificationException The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
EntityAlreadyExistsException The request was rejected because it attempted to create a resource that already exists.
InvalidInputException The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
LimitExceededException The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
MalformedPolicyDocumentException The request was rejected because the policy document was malformed. The error message describes the specific error.
NameConflictException The request was rejected because the resulting role name conflicts with an existing role in the account.
NoSuchEntityException The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
RoleModifiedException The request was rejected because someone modified the role template while the service was creating the role. Wait a few minutes and try the request again.
RoleTemplateDisabledException The request was rejected because the specified role template is disabled. A disabled role template cannot be used to create new roles. Contact your administrator to enable the role template, or use a different role template.
ServiceFailureException The request processing has failed because of an unknown error, exception or failure.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.7.2 and newer

See Also