Class GrantOnPrincipalAndResourceOptions
Options for a grant operation to both identity and resource.
Inherited Members
Namespace: Amazon.CDK.AWS.IAM
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class GrantOnPrincipalAndResourceOptions : IGrantOnPrincipalAndResourceOptions, ICommonGrantOptions
Syntax (vb)
Public Class GrantOnPrincipalAndResourceOptions Implements IGrantOnPrincipalAndResourceOptions, ICommonGrantOptions
Remarks
ExampleMetadata: fixture=_generated
Examples
// 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 conditions;
IGrantable grantable;
IPrincipal principal;
IResourceWithPolicyV2 resourceWithPolicyV2;
var grantOnPrincipalAndResourceOptions = new GrantOnPrincipalAndResourceOptions {
Actions = new [] { "actions" },
Grantee = grantable,
Resource = resourceWithPolicyV2,
ResourceArns = new [] { "resourceArns" },
// the properties below are optional
Conditions = new Dictionary<string, IDictionary<string, object>> {
{ "conditionsKey", new Dictionary<string, object> {
{ "conditionsKey", conditions }
} }
},
ResourcePolicyPrincipal = principal,
ResourceSelfArns = new [] { "resourceSelfArns" }
};
Synopsis
Constructors
| GrantOnPrincipalAndResourceOptions() | Options for a grant operation to both identity and resource. |
Properties
| Actions | The actions to grant. |
| Conditions | Any conditions to attach to the grant. |
| Grantee | The principal to grant to. |
| Resource | The resource with a resource policy. |
| ResourceArns | The resource ARNs to grant to. |
| ResourcePolicyPrincipal | The principal to use in the statement for the resource policy. |
| ResourceSelfArns | When referring to the resource in a resource policy, use this as ARN. |
Constructors
GrantOnPrincipalAndResourceOptions()
Options for a grant operation to both identity and resource.
public GrantOnPrincipalAndResourceOptions()
Remarks
ExampleMetadata: fixture=_generated
Examples
// 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 conditions;
IGrantable grantable;
IPrincipal principal;
IResourceWithPolicyV2 resourceWithPolicyV2;
var grantOnPrincipalAndResourceOptions = new GrantOnPrincipalAndResourceOptions {
Actions = new [] { "actions" },
Grantee = grantable,
Resource = resourceWithPolicyV2,
ResourceArns = new [] { "resourceArns" },
// the properties below are optional
Conditions = new Dictionary<string, IDictionary<string, object>> {
{ "conditionsKey", new Dictionary<string, object> {
{ "conditionsKey", conditions }
} }
},
ResourcePolicyPrincipal = principal,
ResourceSelfArns = new [] { "resourceSelfArns" }
};
Properties
Actions
The actions to grant.
public string[] Actions { get; set; }
Property Value
string[]
Remarks
ExampleMetadata: fixture=_generated
Conditions
Any conditions to attach to the grant.
public IDictionary<string, IDictionary<string, object>>? Conditions { get; set; }
Property Value
IDictionary<string, IDictionary<string, object>>
Remarks
Default: - No conditions
Grantee
The principal to grant to.
public IGrantable Grantee { get; set; }
Property Value
Remarks
Default: if principal is undefined, no work is done.
Resource
The resource with a resource policy.
public IResourceWithPolicyV2 Resource { get; set; }
Property Value
Remarks
The statement will always be added to the resource policy.
ResourceArns
The resource ARNs to grant to.
public string[] ResourceArns { get; set; }
Property Value
string[]
Remarks
ExampleMetadata: fixture=_generated
ResourcePolicyPrincipal
The principal to use in the statement for the resource policy.
public IPrincipal? ResourcePolicyPrincipal { get; set; }
Property Value
Remarks
Default: - the principal of the grantee will be used
ResourceSelfArns
When referring to the resource in a resource policy, use this as ARN.
public string[]? ResourceSelfArns { get; set; }
Property Value
string[]
Remarks
(Depending on the resource type, this needs to be '*' in a resource policy).
Default: Same as regular resource ARNs