FromRoleNameOptions Struct
Options allowing customizing the behavior of Role.fromRoleName.
| Source | aws-iam/lib/role.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iam as iam } from 'aws-cdk-lib';
const fromRoleNameOptions: iam.FromRoleNameOptions = {
addGrantsToResources: false,
defaultPolicyName: 'defaultPolicyName',
mutable: false,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_iam as iam
from_role_name_options = iam.FromRoleNameOptions(
add_grants_to_resources=False,
default_policy_name="defaultPolicyName",
mutable=False
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.iam.*;
FromRoleNameOptions fromRoleNameOptions = FromRoleNameOptions.builder()
.addGrantsToResources(false)
.defaultPolicyName("defaultPolicyName")
.mutable(false)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.IAM;
var fromRoleNameOptions = new FromRoleNameOptions {
AddGrantsToResources = false,
DefaultPolicyName = "defaultPolicyName",
Mutable = false
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
fromRoleNameOptions := &FromRoleNameOptions{
AddGrantsToResources: jsii.Boolean(false),
DefaultPolicyName: jsii.String("defaultPolicyName"),
Mutable: jsii.Boolean(false),
}
Properties
addGrantsToResourcesoptionalbooleanadd_grants_to_resourcesoptionalbooladdGrantsToResourcesoptionalBooleanAddGrantsToResourcesoptionalboolAddGrantsToResourcesoptional*bool = false #For immutable roles: add grants to resources instead of dropping them.
notes
If this is false or not specified, grant permissions added to this role are ignored. It is your own responsibility to make sure the role has the required permissions.
If this is true, any grant permissions will be added to the resource instead.
defaultPolicyNameoptionalstringdefault_policy_nameoptionalstrdefaultPolicyNameoptionalStringDefaultPolicyNameoptionalstringDefaultPolicyNameoptional*string = 'Policy' #Any policies created by this role will use this value as their ID, if specified.
notes
Specify this if importing the same role in multiple stacks, and granting it different permissions in at least two stacks. If this is not specified (or if the same name is specified in more than one stack), a CloudFormation issue will result in the policy created in whichever stack is deployed last overwriting the policies created by the others.
mutableoptionalbooleanmutableoptionalboolmutableoptionalBooleanMutableoptionalboolMutableoptional*bool = true #Whether the imported role can be modified by attaching policy resources to it.