# Interface IFunction

##### Inherited Members

**Namespace**: Amazon.CDK.AWS.Lambda

**Assembly**: Amazon.CDK.AWS.Lambda.dll

##### Syntax (csharp)

`public interface IFunction : IResource, IConstruct, IConstruct, IDependable, IConnectable, IGrantable`

##### Syntax (vb)

```
Public Interface IFunction
Inherits IResource, IConstruct, IConstruct, IDependable, IConnectable, IGrantable
```

**Remarks**

**Stability**: Stable

### Synopsis

#### Properties

FunctionArn | The ARN fo the function. |

FunctionName | The name of the function. |

IsBoundToVpc | Whether or not this Lambda function was bound to a VPC. |

LatestVersion | The |

PermissionsNode | The construct node where permissions are attached. |

Role | The IAM role associated with this function. |

#### Methods

AddEventSource(IEventSource) | |

AddEventSourceMapping(String, IEventSourceMappingOptions) | Adds an event source that maps to this AWS Lambda function. |

AddPermission(String, IPermission) | Adds a permission to the Lambda resource policy. |

AddToRolePolicy(PolicyStatement) | Adds a statement to the IAM role assumed by the instance. |

ConfigureAsyncInvoke(IEventInvokeConfigOptions) | Configures options for asynchronous invocation. |

GrantInvoke(IGrantable) | Grant the given identity permissions to invoke this Lambda. |

Metric(String, IMetricOptions) | Return the given named metric for this Lambda Return the given named metric for this Function. |

MetricDuration(IMetricOptions) | Metric for the Duration of this Lambda How long execution of this Lambda takes. |

MetricErrors(IMetricOptions) | How many invocations of this Lambda fail. |

MetricInvocations(IMetricOptions) | Metric for the number of invocations of this Lambda How often this Lambda is invoked. |

MetricThrottles(IMetricOptions) | Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled. |

### Properties

#### FunctionArn

The ARN fo the function.

`string FunctionArn { get; }`

##### Property Value

System.String

##### Remarks

**Stability**: Stable

**Attribute**: true

#### FunctionName

The name of the function.

`string FunctionName { get; }`

##### Property Value

System.String

##### Remarks

**Stability**: Stable

**Attribute**: true

#### IsBoundToVpc

Whether or not this Lambda function was bound to a VPC.

`bool IsBoundToVpc { get; }`

##### Property Value

System.Boolean

##### Remarks

If this is is `false`

, trying to access the `connections`

object will fail.

**Stability**: Stable

#### LatestVersion

The `$LATEST`

version of this function.

`IVersion LatestVersion { get; }`

##### Property Value

##### Remarks

**Stability**: Stable

#### PermissionsNode

The construct node where permissions are attached.

`ConstructNode PermissionsNode { get; }`

##### Property Value

##### Remarks

**Stability**: Stable

#### Role

The IAM role associated with this function.

`virtual IRole Role { get; }`

##### Property Value

##### Remarks

**Stability**: Stable

### Methods

#### AddEventSource(IEventSource)

#### AddEventSourceMapping(String, IEventSourceMappingOptions)

Adds an event source that maps to this AWS Lambda function.

`EventSourceMapping AddEventSourceMapping(string id, IEventSourceMappingOptions options)`

##### Parameters

- id System.String
construct ID.

- options IEventSourceMappingOptions
mapping options.

##### Returns

##### Remarks

**Stability**: Stable

#### AddPermission(String, IPermission)

Adds a permission to the Lambda resource policy.

`void AddPermission(string id, IPermission permission)`

##### Parameters

- id System.String
The id ƒor the permission construct.

- permission IPermission
The permission to grant to this Lambda function.

##### Remarks

**Stability**: Stable

**See**: Permission for details.

#### AddToRolePolicy(PolicyStatement)

Adds a statement to the IAM role assumed by the instance.

`void AddToRolePolicy(PolicyStatement statement)`

##### Parameters

- statement PolicyStatement

##### Remarks

**Stability**: Stable

#### ConfigureAsyncInvoke(IEventInvokeConfigOptions)

Configures options for asynchronous invocation.

`void ConfigureAsyncInvoke(IEventInvokeConfigOptions options)`

##### Parameters

- options IEventInvokeConfigOptions

##### Remarks

**Stability**: Stable

#### GrantInvoke(IGrantable)

Grant the given identity permissions to invoke this Lambda.

`Grant GrantInvoke(IGrantable identity)`

##### Parameters

- identity IGrantable

##### Returns

##### Remarks

**Stability**: Stable

#### Metric(String, IMetricOptions)

Return the given named metric for this Lambda Return the given named metric for this Function.

`Metric Metric(string metricName, IMetricOptions props = null)`

##### Parameters

- metricName System.String
- props IMetricOptions

##### Returns

##### Remarks

**Stability**: Stable

#### MetricDuration(IMetricOptions)

Metric for the Duration of this Lambda How long execution of this Lambda takes.

`Metric MetricDuration(IMetricOptions props = null)`

##### Parameters

- props IMetricOptions

##### Returns

##### Remarks

Average over 5 minutes

**Default**: average over 5 minutes

**Stability**: Stable

#### MetricErrors(IMetricOptions)

How many invocations of this Lambda fail.

`Metric MetricErrors(IMetricOptions props = null)`

##### Parameters

- props IMetricOptions

##### Returns

##### Remarks

Sum over 5 minutes

**Stability**: Stable

#### MetricInvocations(IMetricOptions)

Metric for the number of invocations of this Lambda How often this Lambda is invoked.

`Metric MetricInvocations(IMetricOptions props = null)`

##### Parameters

- props IMetricOptions

##### Returns

##### Remarks

Sum over 5 minutes

**Default**: sum over 5 minutes

**Stability**: Stable

#### MetricThrottles(IMetricOptions)

Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.

`Metric MetricThrottles(IMetricOptions props = null)`

##### Parameters

- props IMetricOptions

##### Returns

##### Remarks

Sum over 5 minutes

**Default**: sum over 5 minutes

**Stability**: Stable