Skip to content
v2.277.0

GrantOnPrincipalOptions Struct ​

Options for a grant operation that only applies to principals.

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';
import * as constructs from 'constructs';

declare const conditions: any;
declare const construct: constructs.Construct;
declare const grantable: iam.IGrantable;
const grantOnPrincipalOptions: iam.GrantOnPrincipalOptions = {
  actions: ['actions'],
  grantee: grantable,
  resourceArns: ['resourceArns'],

  // the properties below are optional
  conditions: {
    conditionsKey: {
      conditionsKey: conditions,
    },
  },
  scope: construct,
};
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
import constructs as constructs

# conditions: Any
# construct: constructs.Construct
# grantable: iam.IGrantable

grant_on_principal_options = iam.GrantOnPrincipalOptions(
    actions=["actions"],
    grantee=grantable,
    resource_arns=["resourceArns"],

    # the properties below are optional
    conditions={
        "conditions_key": {
            "conditions_key": conditions
        }
    },
    scope=construct
)
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.*;
import software.constructs.*;

Object conditions;
Construct construct;
IGrantable grantable;

GrantOnPrincipalOptions grantOnPrincipalOptions = GrantOnPrincipalOptions.builder()
        .actions(List.of("actions"))
        .grantee(grantable)
        .resourceArns(List.of("resourceArns"))

        // the properties below are optional
        .conditions(Map.of(
                "conditionsKey", Map.of(
                        "conditionsKey", conditions)))
        .scope(construct)
        .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;
using Constructs;

var conditions;
Construct construct;
IGrantable grantable;
var grantOnPrincipalOptions = new GrantOnPrincipalOptions {
    Actions = new [] { "actions" },
    Grantee = grantable,
    ResourceArns = new [] { "resourceArns" },

    // the properties below are optional
    Conditions = new Dictionary<string, IDictionary<string, object>> {
        { "conditionsKey", new Dictionary<string, object> {
            { "conditionsKey", conditions }
        } }
    },
    Scope = construct
};
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"
import constructs "github.com/aws/constructs-go/constructs"

var conditions interface{}
var construct Construct
var grantable IGrantable

grantOnPrincipalOptions := &GrantOnPrincipalOptions{
	Actions: []*string{
		jsii.String("actions"),
	},
	Grantee: grantable,
	ResourceArns: []*string{
		jsii.String("resourceArns"),
	},

	// the properties below are optional
	Conditions: map[string]map[string]interface{}{
		"conditionsKey": map[string]interface{}{
			"conditionsKey": conditions,
		},
	},
	Scope: construct,
}

Properties ​

actionsstring[]actionstyping.List[str]actionsList<String>Actionsstring[]Actions*[]*string required #
The actions to grant.
conditionsoptional{ [key: string]: { [key: string]: any } }conditionsoptionaltyping.Mapping[str, typing.Mapping[str, Any]]conditionsoptionalMap<String, Map<String, Object>>ConditionsoptionalIDictionary<string, IDictionary<string, object>>Conditionsoptional*map[string]*map[string]interface{} #
Any conditions to attach to the grant.

Default: No conditions

granteeIGrantablegranteeIGrantablegranteeIGrantableGranteeIGrantableGranteeIGrantable required #
The principal to grant to.

Default: if principal is undefined, no work is done.

resourceArnsstring[]resource_arnstyping.List[str]resourceArnsList<String>ResourceArnsstring[]ResourceArns*[]*string required #
The resource ARNs to grant to.
scopeoptionalIConstructscopeoptionalIConstructscopeoptionalIConstructScopeoptionalIConstructScopeoptionalIConstruct deprecated #
The scope argument is currently unused.

Default: the construct in which this construct is defined