Metadata-Version: 2.1
Name: cdk-iam-floyd
Version: 0.852.0
Summary: AWS IAM policy statement generator with fluent interface for AWS CDK for AWS CDK
Home-page: https://github.com/udondan/iam-floyd
Author: Daniel Schroeder
License: Apache-2.0
Project-URL: Source, https://github.com/udondan/iam-floyd.git
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aws-cdk-lib <3.0.0,>=2.275.0
Requires-Dist: constructs <11.0.0,>=10.5.0
Requires-Dist: jsii <2.0.0,>=1.142.0
Requires-Dist: publication >=0.0.3

# IAM Floyd

[![Release](https://img.shields.io/github/v/release/udondan/iam-floyd?label=release)](https://github.com/udondan/iam-floyd/releases)
[![Documentation](https://img.shields.io/readthedocs/iam-floyd?label=docs)](https://iam-floyd.readthedocs.io/en/latest/)
[![Construct Hub](https://img.shields.io/badge/Construct%20Hub-cdk--iam--floyd-blue)](https://constructs.dev/packages/cdk-iam-floyd)
[![License](https://img.shields.io/github/license/udondan/iam-floyd)](https://github.com/udondan/iam-floyd/blob/main/LICENSE)

**AWS [IAM policy statement](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_statement.html) generator with a fluent interface, for TypeScript, JavaScript, Python, Java, C# and Go.**

IAM Floyd has a class for every AWS service, with a method for every action, resource type and condition key. Your IDE completes them and shows their documentation, so you neither look up action names and ARN formats, nor deploy policies with typos.

```python
from cdk_iam_floyd import Statement

statement = (
    Statement.Ec2()
        .allow()
        .to_start_instances()
        .to_stop_instances()
        .if_resource_tag('Owner', '${aws:username}')
)
```

```json
{
  "Condition": {
    "StringLike": {
      "ec2:ResourceTag/Owner": "${aws:username}"
    }
  },
  "Action": ["ec2:StartInstances", "ec2:StopInstances"],
  "Resource": "*",
  "Effect": "Allow"
}
```

<!-- stats -->

Support for:

* 457 Services
* 22305 Actions
* 2347 Resource Types
* 2513 Condition keys

<!-- /stats -->

## Features

* **Complete**: generated from the [AWS documentation](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html), and updated every week
* **Access levels**: add all actions of an access level, e.g. `allReadActions()` or `allWriteActions()`
* **Regular expressions**: add all actions that match a pattern with `allMatchingActions('/vpn/i')`
* **Resources**: build ARNs with a method per resource type, e.g. `onBucket('example-bucket')`, with defaults for partition, region and account
* **Conditions**: a method per condition key, with operators like `ForAnyValue:StringEquals` or `IfExists`
* **AWS CDK**: `cdk-iam-floyd` statements are an [`iam.PolicyStatement`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html) of the AWS CDK, and the `on*()` methods take constructs, e.g. `onBucket(bucket)`
* **Policies**: a policy document that knows the maximum size of its type, validates its estimated size and splits itself into several policies
* **Collections** of common statements, and the names of all AWS managed policies
* **Policy converter**: turn an existing JSON policy into IAM Floyd code with the [online converter](https://iam-floyd.readthedocs.io/en/latest/policy-converter.html)

## Packages

IAM Floyd comes in two variants, with the same API and the same version number in every language:

* **`iam-floyd`** creates statements as JSON, for the AWS SDKs, CloudFormation, Terraform or anything else that takes an IAM policy. The packages have no dependencies. In Python, Java, C# and Go, they are native and do not need Node.js.
* **`cdk-iam-floyd`** creates statements of the [AWS CDK](https://aws.amazon.com/cdk/) v2. In Python, Java, C# and Go, they are built with [jsii](https://aws.github.io/jsii/), like the AWS CDK itself, and need Node.js.

| Language                | `iam-floyd`                            | `cdk-iam-floyd`                                |
| ----------------------- | -------------------------------------- | ---------------------------------------------- |
| TypeScript / JavaScript | [![npm](https://img.shields.io/npm/v/iam-floyd?label=npm&color=3178C6&logo=typescript&logoColor=white)](https://www.npmjs.com/package/iam-floyd)               | [![npm](https://img.shields.io/npm/v/cdk-iam-floyd?label=npm&color=3178C6&logo=typescript&logoColor=white)](https://www.npmjs.com/package/cdk-iam-floyd)               |
| Python                  | [![PyPI](https://img.shields.io/pypi/v/iam-floyd?label=PyPI&color=3776AB&logo=python&logoColor=white)](https://pypi.org/project/iam-floyd/)            | [![PyPI](https://img.shields.io/pypi/v/cdk-iam-floyd?label=PyPI&color=3776AB&logo=python&logoColor=white)](https://pypi.org/project/cdk-iam-floyd/)            |
| Java                    | [![Maven Central](https://img.shields.io/maven-central/v/com.udondan/iam-floyd?label=Maven%20Central&color=ED8B00&logo=openjdk&logoColor=white)](https://central.sonatype.com/artifact/com.udondan/iam-floyd) | [![Maven Central](https://img.shields.io/maven-central/v/com.udondan/cdk-iam-floyd?label=Maven%20Central&color=ED8B00&logo=openjdk&logoColor=white)](https://central.sonatype.com/artifact/com.udondan/cdk-iam-floyd) |
| C# / .NET               | [![NuGet](https://img.shields.io/nuget/v/IAM.Floyd?label=NuGet&color=512BD4&logo=dotnet&logoColor=white)](https://www.nuget.org/packages/IAM.Floyd)         | [![NuGet](https://img.shields.io/nuget/v/CDK.IAM.Floyd?label=NuGet&color=512BD4&logo=dotnet&logoColor=white)](https://www.nuget.org/packages/CDK.IAM.Floyd)         |
| Go                      | [![Go](https://img.shields.io/github/v/release/udondan/iam-floyd?label=Go&color=00ADD8&logo=go&logoColor=white)](https://pkg.go.dev/udondan.github.io/iam-floyd/go/iamfloyd)                  | [![Go](https://img.shields.io/github/v/release/udondan/iam-floyd?label=Go&color=00ADD8&logo=go&logoColor=white)](https://pkg.go.dev/udondan.github.io/iam-floyd/go/cdkiamfloyd)                      |

### Installation

```bash
pip install cdk-iam-floyd
```

IAM Floyd has not reached 1.0.0 yet, and the API can still change between releases. Pin the exact version.

The requirements of each package and the compatibility with the AWS CDK are listed in the [documentation](https://iam-floyd.readthedocs.io/en/latest/packages.html).

## Documentation

The [documentation](https://iam-floyd.readthedocs.io/en/latest/) explains all features, with examples in every language.

[![Auto completion demo](https://raw.githubusercontent.com/udondan/iam-floyd/main/docs/movie-preview.png)](https://www.youtube.com/watch?v=4dHY8qPHbKA)

## Legal

The service models in the [lib/generated/model](https://github.com/udondan/iam-floyd/tree/main/lib/generated/model) folder, and the code generated from them, are derived from the [AWS documentation](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html). The class- and function-names and their description therefore are property of AWS.

AWS and their services are trademarks, registered trademarks or trade dress of AWS in the U.S. and/or other countries.

This project is not affiliated, funded, or in any way associated with AWS.

IAM Floyd is licensed under [Apache License 2.0](https://github.com/udondan/iam-floyd/blob/main/LICENSE). Dependencies might be released under different licenses.
