iam-floyd 0.848.0 → 0.849.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,16 @@
1
1
  config:
2
2
  # Long lines are wrapped by the reader
3
3
  MD013: false
4
- # Line breaks in lists, like the packages in README.md
4
+ # Line breaks in tables and the collapsible examples per language in README.md
5
5
  MD033:
6
- allowed_elements: [br]
6
+ allowed_elements: [br, details, summary]
7
+ # gofmt indents with tabs
8
+ MD010:
9
+ ignore_code_languages: [go]
7
10
  globs:
8
11
  - "**/*.md"
9
12
  ignores:
10
13
  - "**/node_modules/**"
11
14
  - CHANGELOG.md
12
15
  - dist/**
16
+ - java/target/**
package/.prettierignore CHANGED
@@ -2,3 +2,4 @@
2
2
  CHANGELOG.md
3
3
  lib/generated/
4
4
  docs/source/_static/managed-policies/
5
+ docs/source/_static/policy-converter/
package/AGENTS.md CHANGED
@@ -16,7 +16,7 @@ IAM Floyd is an AWS IAM policy statement generator with a fluent interface. It g
16
16
  - `lib/generated/aws-managed-policies/` - Generated AWS managed policies (committed)
17
17
  - `lib/shared/` - Hand-written core: `PolicyStatement`, `All`, `Operator`, `AccessLevel`
18
18
  - `lib/collection/` - Predefined policy collection utilities
19
- - `lib/generator/` - Scrapes AWS docs with `cheerio` into the model (`model.ts`), and emits TypeScript from the model with `ts-morph` (`emit/typescript.ts`)
19
+ - `lib/generator/` - Scrapes AWS docs with `cheerio` into the model (`model.ts`), and emits TypeScript from the model with `ts-morph` (`emit/typescript.ts`), and the index of the policy converter (`emit/converter.ts`)
20
20
 
21
21
  ### PolicyStatement Inheritance Chain
22
22
 
@@ -44,16 +44,34 @@ One codebase produces two npm packages:
44
44
 
45
45
  `test/jsii/` builds `floyd-consumer`, a jsii library that depends on `cdk-iam-floyd`, and runs the same scenarios in TypeScript (the baseline, without jsii), Python, Java, .NET and Go against `test/jsii/expected.json`. It also runs the examples of the docs in each language (`examples/<name>/<name>.{py,java,cs,go}`, through the runners in `test/jsii/examples/`) and compares them to the `.result` files. Every example needs a file in every language.
46
46
 
47
- Publishing: the npm package of `cdk-iam-floyd` includes the `.jsii` (`make package-jsii publish LANGUAGES=typescript`), Python goes to PyPI and .NET to NuGet (both trusted publishing), Java to Maven Central (`bin/publish-maven`, signed bundle via the Central Portal API). Go has no registry: `bin/go-proxy` writes the module zip, which is attached to the GitHub release, and a static Go module proxy for the newest 30 releases, served by GitHub Pages under `udondan.github.io/iam-floyd/go`.
47
+ Publishing: the npm package of `cdk-iam-floyd` includes the `.jsii` (`make package-jsii publish LANGUAGES=typescript`), Python goes to PyPI and .NET to NuGet (both trusted publishing), Java to Maven Central (`bin/publish-maven`, signed bundle via the Central Portal API). Go has no registry: `bin/go-proxy` writes the module zip, which is attached to the GitHub release, and a static Go module proxy of both modules (`cdkiamfloyd` and the native `iamfloyd`) for the newest 30 releases, served by GitHub Pages under `udondan.github.io/iam-floyd/go` (job `publish-go-proxy`).
48
48
 
49
49
  ### Native Packages (transpiled core)
50
50
 
51
- The standalone `iam-floyd` is being built natively for other languages, without jsii and without Node.js. The hand-written code in `lib/shared/` (the core) and `lib/collection/`, and the names of the AWS managed policies (`lib/generated/aws-managed-policies/iam-floyd.ts`), are transpiled with ts-morph by `lib/generator/transpile/` (`index.ts` collects the files of a module in import order, one backend per language, currently `python.ts`). The only imports from outside a module are the generated service classes, imported from their file (e.g. `../generated/policy-statements/ec2`). The transpiler supports only a narrow subset of TypeScript: anything else fails with file and line, so rewrite the code in supported constructs rather than extending the transpiler for single cases. The service classes are emitted from the model by `lib/generator/emit/python.ts`, with the jsii naming rules (snake_case, `if_`, `in_`), into the package `statement/`, which imports a service on first access. `bin/transpile.ts` writes `python/iam_floyd/_shared.py`, `_collection.py`, `_aws_managed_policies.py` and `statement/` (not committed). The package imports the collection and the managed policies on first access. `python/iam_floyd/_js.py` is the hand-written runtime for JavaScript semantics (number formatting, `toISOString`, sorting by UTF-16 code units, regular expressions).
51
+ The standalone `iam-floyd` is being built natively for other languages, without jsii and without Node.js. The hand-written code in `lib/shared/` (the core) and `lib/collection/`, and the names of the AWS managed policies (`lib/generated/aws-managed-policies/iam-floyd.ts`), are transpiled with ts-morph by `lib/generator/transpile/` (`index.ts` collects the files of a module in import order, one backend per language: `python.ts`, `java.ts`, `csharp.ts`, `go.ts`). The only imports from outside a module are the generated service classes, imported from their file (e.g. `../generated/policy-statements/ec2`). The transpiler supports only a narrow subset of TypeScript: anything else fails with file and line, so rewrite the code in supported constructs rather than extending the transpiler for single cases. The service classes are emitted from the model by `lib/generator/emit/python.ts`, with the jsii naming rules (snake_case, `if_`, `in_`), into the package `statement/`, which imports a service on first access. `bin/transpile.ts` writes `python/iam_floyd/_shared.py`, `_collection.py`, `_aws_managed_policies.py` and `statement/` (not committed). The package imports the collection and the managed policies on first access. `python/iam_floyd/_js.py` is the hand-written runtime for JavaScript semantics (number formatting, `toISOString`, sorting by UTF-16 code units, regular expressions).
52
52
 
53
- `test/transpile/` runs the scenarios against TypeScript (the baseline) and each language, and diffs the output: those of `scenarios.json`, which test the core, and those that `services.ts` builds from the model, which call every method of every service. Then it runs the examples of the docs (`examples/<name>/<name>.py`) with the native package, through `python/examples.py`, which runs them with `iam_floyd` in place of `cdk_iam_floyd`, and compares them to the `.result` files with `test/jsii/examples/compare.py --standalone`, which skips the `*.cdk` examples. Last, it compares the AWS managed policies with those of TypeScript.
53
+ Java: the core, the collection and `AwsManagedPolicy` go to the package `com.udondan.iamFloyd`, the service classes (emitted by `lib/generator/emit/java.ts`) and `All` to `com.udondan.iamFloyd.statement`, in `java/src/main/java/` (not committed, except the hand-written runtime `Js.java` and `Json.java`, which writes the JSON like `JSON.stringify`). The classes of the statement are generic (`PolicyStatement<T extends PolicyStatement<T>>`, `Ec2 extends PolicyStatement<Ec2>`), so the fluent methods return the class itself. Optional parameters and union types become overloads, reserved words get a prefix (`doIf`, `doFor`), static properties become constants (`Operator.STRING_EQUALS`).
54
+
55
+ C#: the core, the collection and `AwsManagedPolicy` go to the namespace `IAM.Floyd`, the service classes (emitted by `lib/generator/emit/csharp.ts`) and `All` to `IAM.Floyd.Statement`, in `dotnet/src/IAM.Floyd/` (not committed, except the project `IAM.Floyd.csproj` and the hand-written runtime `Js.cs` and `Json.cs`). Like in Java, the classes of the statement are generic (`PolicyStatement<T> where T : PolicyStatement<T>`, `Ec2 : PolicyStatement<Ec2>`), optional parameters and union types become overloads and static properties constants. Names are PascalCase (`If`, `For`, `ToJSON`), public fields become properties (`Sid`), and the service classes hide methods of the core with the same name with `new` (e.g. `IfAwsRequestTag`).
56
+
57
+ Go: the module `udondan.github.io/iam-floyd/go/iamfloyd` in `go/iamfloyd/` (not committed, except `go.mod`, the hand-written helpers `helpers.go` (`String`, `Strings`, `Number`, `Bool`) and the runtime in `internal/js/`). The core and `AwsManagedPolicy` go to the package `iamfloyd`, the collection to `collection`, the service classes (emitted by `lib/generator/emit/go.ts`) and `All` to `statement`. Inheritance becomes embedding of generic structs (`PolicyStatement[T]`, `type Ec2 struct{ iamfloyd.PolicyStatement[*Ec2] }`) with an `InitX` function per class, and the fluent methods return `T`. Parameters are pointers like in jsii (`*string`, `*[]*string`), optional ones are `nil`, union types `interface{}`. Static properties become constants (`Operator_STRING_EQUALS`), the classes with `toJSON` implement `MarshalJSON`. `bin/transpile.ts` runs `gofmt` on the output.
58
+
59
+ `test/transpile/` runs the scenarios against TypeScript (the baseline) and each language, and diffs the output: those of `scenarios.json`, which test the core, and those that `services.ts` builds from the model, which call every method of every service. Then it runs the examples of the docs (`examples/<name>/<name>.{py,java,cs,go}`) with the native package, through `python/examples.py`, which runs them with `iam_floyd` in place of `cdk_iam_floyd`, `java/Examples.java`, which compiles them with `com.udondan.iamFloyd` and a stand-in of the `PolicyDocument` of the AWS CDK (`java/stubs/`), `dotnet/` (`run.sh` rewrites them for `IAM.Floyd`, the project compiles them with a stand-in of the `PolicyDocument` in `Stubs.cs`) and `go/` (`run.sh` rewrites them for `iamfloyd` and the stand-in `awsiam`, and writes `registry.go` with `registry.ts`, as Go cannot look up classes and constants by name), and compares them to the `.result` files with `test/jsii/examples/compare.py --standalone`, which skips the `*.cdk` examples. Last, it compares the AWS managed policies with those of TypeScript.
54
60
 
55
61
  The Python package is built with hatchling from `python/pyproject.toml`; `bin/transpile.ts` writes the version of package.json into `iam_floyd/_version.py`. It supports Python 3.9 and newer, and has no dependencies at runtime. CI builds it and tests the wheel with the oldest and the newest supported Python; for a release, the tested wheel and sdist go to PyPI as `iam-floyd` (trusted publishing, job `publish-iam-floyd-python`).
56
62
 
63
+ The Java package is built with Maven from `java/pom.xml` (`-Drevision=<version of package.json>`), with `--release 11`, into the Maven repository `dist/iam-floyd/java`. CI builds it with the newest Java LTS and tests the jar with Java 11 and the newest LTS; for a release, `bin/publish-maven dist/iam-floyd/java` publishes it to Maven Central as `com.udondan:iam-floyd` (job `publish-iam-floyd-java`).
64
+
65
+ The .NET package is built with `dotnet pack` from `dotnet/src/IAM.Floyd/IAM.Floyd.csproj` (`-p:Version=<version of package.json>`), for .NET 8, into `dist/iam-floyd/dotnet`. CI builds it with the newest .NET SDK and tests the package with .NET 8 and the newest .NET (`DOTNET_PACKAGES`, `DOTNET_FRAMEWORK`); for a release, it goes to NuGet as `IAM.Floyd` (trusted publishing, job `publish-iam-floyd-dotnet`).
66
+
67
+ The Go module is zipped by `bin/go-proxy zip` into `dist/iam-floyd/go`, with the LICENSE. It supports Go 1.21 and newer, and has no dependencies. CI tests the zip with Go 1.21 and the newest Go (`GO_MODULE`); for a release, the zip is attached to the GitHub release (job `publish-iam-floyd-go`) and served by the Go module proxy.
68
+
69
+ ### Policy Converter
70
+
71
+ The policy converter of the docs (`docs/source/policy-converter.rst`) converts an IAM policy to IAM Floyd code in TypeScript, JavaScript, Python, Java, C# and Go, for both variants. The conversion is in `docs/source/_static/js/converter.js`, without dependencies, which runs in the browser and in Node.js; `policy-converter.js` is the UI. It knows the classes and actions from `docs/source/_static/policy-converter/services.json`, which `lib/generator/emit/converter.ts` writes from the model on `make emit` and `make generate` (committed, as Read the Docs builds the docs without Node.js).
72
+
73
+ `test/converter/cases.ts` converts the policies of `test/converter/policies/` and all AWS managed policies to JavaScript, runs the code against `lib/` and checks that the policy allows and denies the same as the input. Then it writes the code of the other languages as examples (`converter-<name>`) with their `.result` into a copy of `examples/`, which `test/transpile/run.sh` (Standalone) and `test/jsii/run.sh` (CDK) run with the other examples.
74
+
57
75
  ## Development Commands
58
76
 
59
77
  ### Build
@@ -62,7 +80,7 @@ The Python package is built with hatchling from `python/pyproject.toml`; `bin/tr
62
80
  make emit # emit lib/generated/policy-statements/ and lib/generated/index.ts from the model
63
81
  make build # emit + tsc --build --force tsconfig.main.json tsconfig.types.json
64
82
  make package # build + npm pack
65
- make package-native # transpile and build the native packages of iam-floyd into dist/iam-floyd/ (Python: uv build)
83
+ make package-native # transpile and build the native packages of iam-floyd into dist/iam-floyd/ (Python: uv build, Java: mvn, .NET: dotnet pack, Go: module zip); LANGUAGES=python limits the languages
66
84
  make clean # remove node_modules, *.js, *.d.ts
67
85
  make install # clean + npm i
68
86
  ```
@@ -89,7 +107,7 @@ make test-typescript-cdk # after `make cdk`: same for the CDK examples (examples
89
107
  make cdk-test # CDK test: real deploy + destroy via AWS CDK
90
108
  make cdk-all # cdk + install + build + cdk-test
91
109
  make test-jsii # test the packages of `make package-jsii` against TypeScript; LANGUAGES=python limits the languages
92
- make test-transpile # transpile, compare the scenarios of test/transpile/ with TypeScript and run the examples; PYTHON_WHEEL=<wheel> tests the built package
110
+ make test-transpile # transpile, compare the scenarios of test/transpile/ with TypeScript and run the examples; PYTHON_WHEEL=<wheel>, JAVA_JAR=<jar>, DOTNET_PACKAGES=<dir of the nupkg> and GO_MODULE=<zip> test the built packages
93
111
  ```
94
112
 
95
113
  **Run a single example test manually:**
@@ -119,20 +137,20 @@ make lint-cdk # after `make cdk`: eslint on the CDK variant
119
137
 
120
138
  `bin/lint` runs:
121
139
 
122
- | Linter | Files |
123
- | ---------------------------- | ----------------------------------------------------- |
124
- | eslint (`eslint.config.mjs`) | TypeScript and JavaScript, with types |
125
- | prettier | everything prettier knows, except `.prettierignore` |
126
- | markdownlint-cli2 | Markdown |
127
- | exact versions | the dependencies of all `package.json` files |
128
- | ruff, ruff format | Python (`ruff.toml`, the examples are not formatted) |
129
- | yamllint | YAML (`.yamllint.yaml`) |
130
- | doc8 | reStructuredText in `docs/source` (`doc8.ini`) |
131
- | zizmor, actionlint | GitHub workflows |
132
- | shellcheck, shfmt | shell scripts, found by their shebang |
133
- | gofmt | Go |
134
- | dotnet format whitespace | C# in `examples/` and `test/jsii/` |
135
- | checkstyle (Google style) | Java in `examples/` and `test/jsii/` (`lint/pom.xml`) |
140
+ | Linter | Files |
141
+ | ---------------------------- | ------------------------------------------------------- |
142
+ | eslint (`eslint.config.mjs`) | TypeScript and JavaScript, with types |
143
+ | prettier | everything prettier knows, except `.prettierignore` |
144
+ | markdownlint-cli2 | Markdown |
145
+ | exact versions | the dependencies of all `package.json` files |
146
+ | ruff, ruff format | Python (`ruff.toml`, the examples are not formatted) |
147
+ | yamllint | YAML (`.yamllint.yaml`) |
148
+ | doc8 | reStructuredText in `docs/source` (`doc8.ini`) |
149
+ | zizmor, actionlint | GitHub workflows |
150
+ | shellcheck, shfmt | shell scripts, found by their shebang |
151
+ | gofmt | Go |
152
+ | dotnet format whitespace | C# in `examples/`, `test/` and the runtime of `dotnet/` |
153
+ | checkstyle (Google style) | Java in `examples/` and `test/jsii/` (`lint/pom.xml`) |
136
154
 
137
155
  The versions of the linters are pinned, so Renovate updates them: npm packages in `package.json`, Python tools in `lint/requirements.txt` (run with `uv`), Go tools in `lint/go.mod` (`go tool`) and checkstyle in `lint/pom.xml`. Locally, linters whose runtime (uv, Go, .NET, Maven) is missing are skipped; in CI they fail. In the CDK variant, eslint uses `tsconfig.lint-cdk.json`, which resolves `cdk-iam-floyd` to `lib/`, and prettier is off because `mkcdk` writes unformatted code.
138
156
 
@@ -291,6 +309,6 @@ Follow conventional commits:
291
309
  - `index-managed-policies.yml` - Weekly on Sunday: updates managed policies, opens a `feat:` PR with `automerge` label
292
310
  - `release-please.yml` - On push to main: release-please maintains the release PR (version in `package.json` and `docs/source/conf.py`, `CHANGELOG.md`). After each run, `bin/changelog-add-iam-changes` adds the changes of the managed policies and the model since the last release to the new changelog entry of the PR. Merging the PR creates the tag and a draft release, and starts `test-and-publish.yml` with the tag
293
311
  - `automerge-schedule.yml` - Weekly on Monday: merges the release PR
294
- - `test-and-publish.yml` - On PR: `make install lint` (job `lint`), `make install test-typescript` + `make lint-cdk` + CDK deploy test + `make package-jsii test-jsii` per language + `make package-native test-transpile` against the built Python package. Started by `release-please.yml` with a tag: builds the packages from the tag, publishes to npm, PyPI, NuGet, Maven Central and the Go module proxy on GitHub Pages, sets the notes of the release from `CHANGELOG.md` and publishes the release
312
+ - `test-and-publish.yml` - On PR: `make install lint` (job `lint`), `make install test-typescript` + `make lint-cdk` + CDK deploy test + `make package-jsii test-jsii` per language + `make package-native test-transpile` against the built Python, Java, .NET and Go packages. Started by `release-please.yml` with a tag: builds the packages from the tag, publishes to npm, PyPI, NuGet, Maven Central and the Go module proxy on GitHub Pages, sets the notes of the release from `CHANGELOG.md` and publishes the release
295
313
  - `automerge.yml` - Auto-merges PRs labeled `automerge` after tests pass
296
314
  - `test-docs.yml` - Builds Sphinx docs on `docs/**` changes
package/README.md CHANGED
@@ -1,16 +1,101 @@
1
1
  # IAM Floyd
2
2
 
3
- [![Source](https://img.shields.io/github/stars/udondan/iam-floyd?logo=github&label=GitHub%20Stars)][source]
4
- [![iam-floyd](https://img.shields.io/github/v/release/udondan/iam-floyd)][source]
5
- [![Packages](https://img.shields.io/badge/Packages-npm%20%7C%20PyPI%20%7C%20Maven%20%7C%20NuGet%20%7C%20Go-yellow)][packages]
6
- [![Documentation](https://img.shields.io/badge/Documentation-Read%20the%20Docs-orange)][documentation]
7
- [![GitHub](https://img.shields.io/github/license/udondan/iam-floyd)][license]
8
-
9
- <!-- put back - when we actually have tests
10
- [![Test Coverage](https://api.codeclimate.com/v1/badges/cdb84b5646c6805b1a23/test_coverage)](https://codeclimate.com/github/udondan/iam-floyd/test_coverage)
11
- -->
12
-
13
- **AWS [IAM policy statement][statement] generator with fluent interface.**
3
+ [![Release](https://img.shields.io/github/v/release/udondan/iam-floyd?label=release)](https://github.com/udondan/iam-floyd/releases)
4
+ [![Documentation](https://img.shields.io/readthedocs/iam-floyd?label=docs)](https://iam-floyd.readthedocs.io/en/latest/)
5
+ [![Construct Hub](https://img.shields.io/badge/Construct%20Hub-cdk--iam--floyd-blue)](https://constructs.dev/packages/cdk-iam-floyd)
6
+ [![License](https://img.shields.io/github/license/udondan/iam-floyd)](https://github.com/udondan/iam-floyd/blob/main/LICENSE)
7
+
8
+ **AWS [IAM policy statement][statement] generator with a fluent interface, for TypeScript, JavaScript, Python, Java, C# and Go.**
9
+
10
+ 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.
11
+
12
+ ```ts
13
+ import { Statement } from 'iam-floyd';
14
+
15
+ const statement = new Statement.Ec2()
16
+ .allow()
17
+ .toStartInstances()
18
+ .toStopInstances()
19
+ .ifResourceTag('Owner', '${aws:username}');
20
+ ```
21
+
22
+ ```json
23
+ {
24
+ "Condition": {
25
+ "StringLike": {
26
+ "ec2:ResourceTag/Owner": "${aws:username}"
27
+ }
28
+ },
29
+ "Action": ["ec2:StartInstances", "ec2:StopInstances"],
30
+ "Resource": "*",
31
+ "Effect": "Allow"
32
+ }
33
+ ```
34
+
35
+ <details>
36
+ <summary>Python</summary>
37
+
38
+ ```python
39
+ from iam_floyd import Statement
40
+
41
+ statement = (
42
+ Statement.Ec2()
43
+ .allow()
44
+ .to_start_instances()
45
+ .to_stop_instances()
46
+ .if_resource_tag('Owner', '${aws:username}')
47
+ )
48
+ ```
49
+
50
+ </details>
51
+
52
+ <details>
53
+ <summary>Java</summary>
54
+
55
+ ```java
56
+ import com.udondan.iamFloyd.statement.Ec2;
57
+
58
+ Ec2 statement = new Ec2()
59
+ .allow()
60
+ .toStartInstances()
61
+ .toStopInstances()
62
+ .ifResourceTag("Owner", "${aws:username}");
63
+ ```
64
+
65
+ </details>
66
+
67
+ <details>
68
+ <summary>C#</summary>
69
+
70
+ ```csharp
71
+ using Statement = IAM.Floyd.Statement;
72
+
73
+ var statement = new Statement.Ec2()
74
+ .Allow()
75
+ .ToStartInstances()
76
+ .ToStopInstances()
77
+ .IfResourceTag("Owner", "${aws:username}");
78
+ ```
79
+
80
+ </details>
81
+
82
+ <details>
83
+ <summary>Go</summary>
84
+
85
+ ```go
86
+ import (
87
+ "udondan.github.io/iam-floyd/go/iamfloyd"
88
+ "udondan.github.io/iam-floyd/go/iamfloyd/statement"
89
+ )
90
+
91
+ s := statement.NewEc2(nil).
92
+ Allow().
93
+ ToStartInstances().
94
+ ToStopInstances().
95
+ IfResourceTag(iamfloyd.String("Owner"), iamfloyd.String("${aws:username}"), nil)
96
+ ```
97
+
98
+ </details>
14
99
 
15
100
  <!-- stats -->
16
101
 
@@ -23,48 +108,64 @@ Support for:
23
108
 
24
109
  <!-- /stats -->
25
110
 
26
- ![EXPERIMENTAL](https://img.shields.io/badge/stability-experimantal-orange?style=for-the-badge)**<br>This is an early version of the package. The API will change while I implement new features. Therefore make sure you use an exact version in your `package.json` before it reaches 1.0.0.**
111
+ ## Features
27
112
 
28
- ## Documentation
113
+ - **Complete**: generated from the [AWS documentation][aws-docs], and updated every week
114
+ - **Access levels**: add all actions of an access level, e.g. `allReadActions()` or `allWriteActions()`
115
+ - **Regular expressions**: add all actions that match a pattern with `allMatchingActions('/vpn/i')`
116
+ - **Resources**: build ARNs with a method per resource type, e.g. `onBucket('example-bucket')`, with defaults for partition, region and account
117
+ - **Conditions**: a method per condition key, with operators like `ForAnyValue:StringEquals` or `IfExists`
118
+ - **AWS CDK**: `cdk-iam-floyd` statements are an [`iam.PolicyStatement`][cdk-policy-statement] of the AWS CDK
119
+ - **Collections** of common statements, and the names of all AWS managed policies
120
+ - **Policy converter**: turn an existing JSON policy into IAM Floyd code with the [online converter][converter]
29
121
 
30
- Find the documentation at [Read the Docs][documentation].
122
+ ## Packages
31
123
 
32
- [![Auto completion demo](https://raw.githubusercontent.com/udondan/iam-floyd/main/docs/movie-preview.png)](https://www.youtube.com/watch?v=4dHY8qPHbKA 'Auto completion demo')
124
+ IAM Floyd comes in two variants, with the same API and the same version number in every language:
33
125
 
34
- ## Packages
126
+ - **`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.
127
+ - **`cdk-iam-floyd`** creates statements of the [AWS CDK][aws-cdk] v2. In Python, Java, C# and Go, they are built with [jsii][jsii], like the AWS CDK itself, and need Node.js.
128
+
129
+ | Language | `iam-floyd` | `cdk-iam-floyd` |
130
+ | ----------------------- | -------------------------------------- | ---------------------------------------------- |
131
+ | TypeScript / JavaScript | [![npm][npm-badge]][npm] | [![npm][cdk-npm-badge]][cdk-npm] |
132
+ | Python | [![PyPI][pypi-badge]][pypi] | [![PyPI][cdk-pypi-badge]][cdk-pypi] |
133
+ | Java | [![Maven Central][maven-badge]][maven] | [![Maven Central][cdk-maven-badge]][cdk-maven] |
134
+ | C# / .NET | [![NuGet][nuget-badge]][nuget] | [![NuGet][cdk-nuget-badge]][cdk-nuget] |
135
+ | Go | [![Go][go-badge]][go] | [![Go][go-badge]][cdk-go] |
35
136
 
36
- There are two different package variants available:
137
+ ### Installation
37
138
 
38
- - **iam-floyd**: Can be used in AWS SDK or for whatever you need an IAM policy statement for <br>[![npm](https://img.shields.io/npm/dt/iam-floyd?label=npm&color=blueviolet)](https://www.npmjs.com/package/iam-floyd)
39
- - **cdk-iam-floyd**: Integrates into [AWS CDK] and extends [`iam.PolicyStatement`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.PolicyStatement.html)<br>[![npm](https://img.shields.io/npm/dt/cdk-iam-floyd?label=npm&color=orange)](https://www.npmjs.com/package/cdk-iam-floyd)
139
+ ```bash
140
+ # TypeScript / JavaScript
141
+ npm install iam-floyd # or cdk-iam-floyd
40
142
 
41
- **Starting with version 0.300.0, the packages are compatible with CDK v2.** For CDK v1 you can use any version up to:<br>
42
- [![npm CDK v1](https://img.shields.io/badge/npm-0.286.0-yellow)](https://www.npmjs.com/package/cdk-iam-floyd/v/0.286.0)
143
+ # Python
144
+ pip install iam-floyd # or cdk-iam-floyd
43
145
 
44
- cdk-iam-floyd is also available for Python, Java, .NET and Go:<br>
45
- [![PyPI](https://img.shields.io/pypi/v/cdk-iam-floyd?label=PyPI)](https://pypi.org/project/cdk-iam-floyd/)
46
- [![Maven Central](https://img.shields.io/maven-central/v/com.udondan/cdk-iam-floyd?label=Maven%20Central)](https://central.sonatype.com/artifact/com.udondan/cdk-iam-floyd)
47
- [![NuGet](https://img.shields.io/nuget/v/CDK.IAM.Floyd?label=NuGet)](https://www.nuget.org/packages/CDK.IAM.Floyd)
48
- `go get udondan.github.io/iam-floyd/go/cdkiamfloyd`
146
+ # Java (Maven), with the version of the release
147
+ # com.udondan:iam-floyd # or com.udondan:cdk-iam-floyd
49
148
 
50
- ## CDK Compatibility Matrix
149
+ # C# / .NET
150
+ dotnet add package IAM.Floyd # or CDK.IAM.Floyd
51
151
 
52
- | CDK | cdk-iam-floyd |
53
- | ---------- | -------------------------- |
54
- | <= 1.151.0 | <= 0.285.0 |
55
- | >= 1.152.0 | 0.286.0 |
56
- | >= 1.158.0 | **No compatible version!** |
57
- | >= 2.0.0 | >= 0.300.0 |
58
- | >= 2.20.0 | >= 0.351.0 |
59
- | >= 2.26.0 | >= 0.377.0 |
60
- | 2.29.x | **No compatible version!** |
61
- | >= 2.30.0 | >= 0.391.0 |
152
+ # Go
153
+ go get udondan.github.io/iam-floyd/go/iamfloyd # or .../go/cdkiamfloyd
154
+ ```
62
155
 
63
- ---
156
+ IAM Floyd has not reached 1.0.0 yet, and the API can still change between releases. Pin the exact version.
157
+
158
+ The requirements of each package and the compatibility with the AWS CDK are listed in the [documentation][packages].
159
+
160
+ ## Documentation
161
+
162
+ The [documentation][documentation] explains all features, with examples in every language.
163
+
164
+ [![Auto completion demo](https://raw.githubusercontent.com/udondan/iam-floyd/main/docs/movie-preview.png)](https://www.youtube.com/watch?v=4dHY8qPHbKA 'Auto completion demo')
64
165
 
65
166
  ## Legal
66
167
 
67
- 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/IAM/latest/UserGuide/reference_policies_actions-resources-contextkeys.html). The class- and function-names and their description therefore are property of AWS.
168
+ 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][aws-docs]. The class- and function-names and their description therefore are property of AWS.
68
169
 
69
170
  AWS and their services are trademarks, registered trademarks or trade dress of AWS in the U.S. and/or other countries.
70
171
 
@@ -72,9 +173,31 @@ This project is not affiliated, funded, or in any way associated with AWS.
72
173
 
73
174
  IAM Floyd is licensed under [Apache License 2.0][license]. Dependencies might be released under different licenses.
74
175
 
75
- [source]: https://github.com/udondan/iam-floyd
76
- [documentation]: https://iam-floyd.readthedocs.io/en/latest/
77
- [license]: https://github.com/udondan/iam-floyd/blob/main/LICENSE
78
176
  [statement]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_statement.html
177
+ [aws-docs]: https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html
178
+ [aws-cdk]: https://aws.amazon.com/cdk/
179
+ [cdk-policy-statement]: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html
180
+ [jsii]: https://aws.github.io/jsii/
181
+ [documentation]: https://iam-floyd.readthedocs.io/en/latest/
79
182
  [packages]: https://iam-floyd.readthedocs.io/en/latest/packages.html
80
- [AWS CDK]: https://aws.amazon.com/cdk/
183
+ [converter]: https://iam-floyd.readthedocs.io/en/latest/policy-converter.html
184
+ [license]: https://github.com/udondan/iam-floyd/blob/main/LICENSE
185
+ [npm]: https://www.npmjs.com/package/iam-floyd
186
+ [npm-badge]: https://img.shields.io/npm/v/iam-floyd?label=npm&color=3178C6&logo=typescript&logoColor=white
187
+ [pypi]: https://pypi.org/project/iam-floyd/
188
+ [pypi-badge]: https://img.shields.io/pypi/v/iam-floyd?label=PyPI&color=3776AB&logo=python&logoColor=white
189
+ [maven]: https://central.sonatype.com/artifact/com.udondan/iam-floyd
190
+ [maven-badge]: https://img.shields.io/maven-central/v/com.udondan/iam-floyd?label=Maven%20Central&color=ED8B00&logo=openjdk&logoColor=white
191
+ [nuget]: https://www.nuget.org/packages/IAM.Floyd
192
+ [nuget-badge]: https://img.shields.io/nuget/v/IAM.Floyd?label=NuGet&color=512BD4&logo=dotnet&logoColor=white
193
+ [cdk-npm]: https://www.npmjs.com/package/cdk-iam-floyd
194
+ [cdk-npm-badge]: https://img.shields.io/npm/v/cdk-iam-floyd?label=npm&color=3178C6&logo=typescript&logoColor=white
195
+ [cdk-pypi]: https://pypi.org/project/cdk-iam-floyd/
196
+ [cdk-pypi-badge]: https://img.shields.io/pypi/v/cdk-iam-floyd?label=PyPI&color=3776AB&logo=python&logoColor=white
197
+ [cdk-maven]: https://central.sonatype.com/artifact/com.udondan/cdk-iam-floyd
198
+ [cdk-maven-badge]: https://img.shields.io/maven-central/v/com.udondan/cdk-iam-floyd?label=Maven%20Central&color=ED8B00&logo=openjdk&logoColor=white
199
+ [cdk-nuget]: https://www.nuget.org/packages/CDK.IAM.Floyd
200
+ [cdk-nuget-badge]: https://img.shields.io/nuget/v/CDK.IAM.Floyd?label=NuGet&color=512BD4&logo=dotnet&logoColor=white
201
+ [go]: https://pkg.go.dev/udondan.github.io/iam-floyd/go/iamfloyd
202
+ [cdk-go]: https://pkg.go.dev/udondan.github.io/iam-floyd/go/cdkiamfloyd
203
+ [go-badge]: https://img.shields.io/github/v/release/udondan/iam-floyd?label=Go&color=00ADD8&logo=go&logoColor=white
@@ -0,0 +1,36 @@
1
+ <!--
2
+ The native .NET package of iam-floyd. Most of the sources are written by bin/transpile.ts.
3
+ `make package-native` packs it with the version of package.json into dist/iam-floyd/dotnet.
4
+ -->
5
+ <Project Sdk="Microsoft.NET.Sdk">
6
+ <PropertyGroup>
7
+ <TargetFramework>net8.0</TargetFramework>
8
+ <LangVersion>12</LangVersion>
9
+ <Nullable>disable</Nullable>
10
+ <ImplicitUsings>disable</ImplicitUsings>
11
+ <RootNamespace>IAM.Floyd</RootNamespace>
12
+ <AssemblyName>IAM.Floyd</AssemblyName>
13
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
14
+ <!-- protected members have no documentation -->
15
+ <NoWarn>$(NoWarn);CS1591</NoWarn>
16
+ <Deterministic>true</Deterministic>
17
+ <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
18
+
19
+ <Version>0.0.0</Version>
20
+ <PackageId>IAM.Floyd</PackageId>
21
+ <Title>iam-floyd</Title>
22
+ <Description>AWS IAM policy statement generator with fluent interface</Description>
23
+ <Authors>Daniel Schroeder</Authors>
24
+ <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
25
+ <PackageProjectUrl>https://github.com/udondan/iam-floyd</PackageProjectUrl>
26
+ <RepositoryUrl>https://github.com/udondan/iam-floyd.git</RepositoryUrl>
27
+ <RepositoryType>git</RepositoryType>
28
+ <PackageTags>aws;iam;policy;statement;generator</PackageTags>
29
+ <PackageReadmeFile>README.md</PackageReadmeFile>
30
+ </PropertyGroup>
31
+
32
+ <ItemGroup>
33
+ <None Include="../../README.md" Pack="true" PackagePath="/" />
34
+ <None Include="../../../LICENSE" Pack="true" PackagePath="/" />
35
+ </ItemGroup>
36
+ </Project>