diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 31c447e79..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - -version: 2 -updates: - - package-ecosystem: "gomod" - directory: "/" - schedule: - interval: "weekly" - day: "tuesday" - time: "10:00" - timezone: "Europe/Berlin" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 000000000..9db742036 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,53 @@ +name-template: "v$RESOLVED_VERSION" +tag-template: "$RESOLVED_VERSION" +version-template: "$MAJOR.$MINOR.$PATCH" +version-resolver: + major: + labels: + - "major" + minor: + labels: + - "minor" + - "enhancement" + patch: + labels: + - "auto-update" + - "patch" + - "fix" + - "bugfix" + - "bug" + - "hotfix" + default: "minor" + +categories: + - title: "🚀 Enhancements" + labels: + - "enhancement" + - "patch" + - title: "🐛 Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - "hotfix" + - title: "🤖 Automatic Updates" + labels: + - "auto-update" + +exclude-labels: + - "skip-changelog" + +change-template: | +
+ $TITLE @$AUTHOR (#$NUMBER) + $BODY +
+template: | + $CHANGES +replacers: + # Remove irrelevant information from Renovate bot + - search: '/---\s+^#.*Renovate configuration(?:.|\n)*?This PR has been generated .*/gm' + replace: "" + # Remove Renovate bot banner image + - search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm' + replace: "" \ No newline at end of file diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..9a16bd250 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,60 @@ +name: docs + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - docs/** + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@v3 + - name: setup pages + uses: actions/configure-pages@v3 + - name: setup python + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: setup cache + run: | + echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - name: handle cache + uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - name: install mkdocs material + run: | + pip install mkdocs-material + - name: run mkdocs material + run: | + mkdocs build + - name: upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # Upload entire repository + path: public/ + - name: deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml deleted file mode 100644 index 2d2fc3100..000000000 --- a/.github/workflows/golang.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: golang - -on: - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: "15 3 * * 0" - -jobs: - build: - name: Test and Build - runs-on: ubuntu-latest - steps: - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - name: Setup tools - run: | - go get golang.org/x/lint/golint - - name: Checkout code - uses: actions/checkout@v2 - - name: Test Project - run: | - make test - - name: Build Project - run: | - make diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml new file mode 100644 index 000000000..98232a84c --- /dev/null +++ b/.github/workflows/release-drafter.yaml @@ -0,0 +1,24 @@ +name: release-drafter + +on: + push: + branches: + - main + paths-ignore: + - .github/** + - docs/** + +permissions: + contents: write + pull-requests: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + with: + publish: false + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.RELEASES_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 16da47e7f..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: release - -on: - push: - tags: - - "v*" - -permissions: - contents: write - packages: write - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Install Cosign - uses: sigstore/cosign-installer@main - with: - cosign-release: "v1.13.0" - - name: Setup Cosign - run: | - echo "${COSIGN_KEY}" > "$GITHUB_WORKSPACE/cosign.key" - env: - COSIGN_KEY: ${{ secrets.COSIGN_KEY }} - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - distribution: goreleaser - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.RELEASES_GITHUB_TOKEN }} - COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b49741264 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,87 @@ +name: goreleaser + +on: + #pull_request: + # branches: + # - main + push: + branches: + - main + tags: + - "*.*.*" + - "v*.*.*" + - "v*.*.*-*" + +permissions: + contents: write + packages: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + - uses: actions/checkout@v3 + if: github.event_name == 'push' + with: + fetch-depth: 0 + - name: setup-go + uses: actions/setup-go@v4 + with: + go-version: 1.21.x + - name: setup qemu + id: qemu + uses: docker/setup-qemu-action@v2 + - name: setup docker buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: install cosign + uses: sigstore/cosign-installer@main + with: + cosign-release: "v2.0.1" + - name: setup cosign + run: | + echo "${COSIGN_KEY}" > "$GITHUB_WORKSPACE/cosign.key" + env: + COSIGN_KEY: ${{ secrets.COSIGN_KEY }} + - name: set goreleaser default args + if: startsWith(github.ref, 'refs/tags/') == true + run: | + echo "GORELEASER_ARGS=" >> $GITHUB_ENV + - name: set goreleaser args for branch + if: startsWith(github.ref, 'refs/tags/') == false + run: | + echo "GORELEASER_ARGS=--snapshot" >> $GITHUB_ENV + - name: set goreleaser args renovate + if: startsWith(github.ref, 'refs/heads/renovate') == true + run: | + echo "GORELEASER_ARGS=--snapshot --skip-publish" >> $GITHUB_ENV + - name: run goreleaser + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --rm-dist ${{ env.GORELEASER_ARGS }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} + - name: push docker images (for branches) + if: github.ref == 'refs/heads/main' || github.event.pull_request.base.ref == 'main' + run: | + docker images --format "{{.Repository}}:{{.Tag}}" | grep "ekristen/aws-nuke" | xargs -L1 docker push + - name: upload artifacts + if: github.event.pull_request.base.ref == 'main' + uses: actions/upload-artifact@v3 + with: + name: binaries + path: releases/*.tar.gz diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..fd5f54773 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,20 @@ +name: tests +on: + pull_request: + branches: + - main +jobs: + test: + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: 1.21.x + - name: download go mods + run: | + go mod download + - name: run go tests + run: | + go test -timeout 60s -run ./... diff --git a/.gitignore b/.gitignore index e32b44cb7..d9f9df1ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,8 @@ -/vendor -/aws-nuke -/aws-nuke-* -/dist -/releases -/mocks +releases .envrc .idea -config.yaml cosign.key -*-config.yaml \ No newline at end of file +/config*.yaml +/*-config.yaml +/config.*.yaml + diff --git a/.goreleaser.yml b/.goreleaser.yml index c0c5174b4..78480ee72 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -44,10 +44,11 @@ dockers: - use: buildx goos: linux goarch: amd64 - dockerfile: Dockerfile.goreleaser + dockerfile: Dockerfile image_templates: - ghcr.io/ekristen/aws-nuke:v{{ .Version }}-amd64 build_flag_templates: + - "--target=goreleaser" - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.title={{.ProjectName}}" @@ -58,10 +59,11 @@ dockers: - use: buildx goos: linux goarch: arm64 - dockerfile: Dockerfile.goreleaser + dockerfile: Dockerfile image_templates: - ghcr.io/ekristen/aws-nuke:v{{ .Version }}-arm64 build_flag_templates: + - "--target=goreleaser" - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.title={{.ProjectName}}" @@ -73,10 +75,11 @@ dockers: goos: linux goarch: arm goarm: "7" - dockerfile: Dockerfile.goreleaser + dockerfile: Dockerfile image_templates: - ghcr.io/ekristen/aws-nuke:v{{ .Version }}-arm32v7 build_flag_templates: + - "--target=goreleaser" - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.title={{.ProjectName}}" @@ -95,7 +98,7 @@ signs: - cmd: cosign stdin: "{{ .Env.COSIGN_PASSWORD }}" args: - ["sign-blob", "--key=cosign.key", "--output=${signature}", "${artifact}"] + ["sign-blob", "--yes", "--key=cosign.key", "--output=${signature}", "${artifact}"] artifacts: all docker_signs: - artifacts: all diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..21a32fc2a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# syntax=docker/dockerfile:1.3-labs +FROM alpine:3.19.0 as base +RUN apk add --no-cache ca-certificates +RUN adduser -D aws-nuke + +FROM ghcr.io/acorn-io/images-mirror/golang:1.21 AS build +COPY / /src +WORKDIR /src +RUN \ + --mount=type=cache,target=/go/pkg \ + --mount=type=cache,target=/root/.cache/go-build \ + go build -o bin/aws-nuke main.go + +FROM base AS goreleaser +COPY aws-nuke /usr/local/bin/aws-nuke +USER aws-nuke + +FROM base +COPY --from=build /src/bin/aws-nuke /usr/local/bin/aws-nuke +USER aws-nuke \ No newline at end of file diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser deleted file mode 100644 index 8d62175ae..000000000 --- a/Dockerfile.goreleaser +++ /dev/null @@ -1,9 +0,0 @@ - -FROM alpine:3.14.3 -ENTRYPOINT ["/usr/local/bin/aws-nuke"] -RUN apk add --no-cache ca-certificates -RUN adduser -D aws-nuke - -COPY aws-nuke /usr/local/bin/aws-nuke - -USER aws-nuke diff --git a/LICENSE b/LICENSE index d18b51b6f..440e09c2f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,10 +1,22 @@ The MIT License (MIT) -Copyright 2021 Erik Kristensen -Copyright 2016-2021 reBuy reCommerce GmbH +Copyright (c) 2016 reBuy reCommerce GmbH +Copyright (c) 2021 Erik Kristensen -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile index d79a9f829..2d28495a5 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ -PACKAGE=github.com/rebuy-de/aws-nuke +docs-build: + docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material build -include golang.mk +docs-serve: + docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material + +docs-seed: + cp README.md docs/index.md \ No newline at end of file diff --git a/README.md b/README.md index 712a45e5c..70ed8efa1 100644 --- a/README.md +++ b/README.md @@ -1,380 +1,79 @@ -# aws-nuke (managed fork) +# aws-nuke [![license](https://img.shields.io/github/license/ekristen/aws-nuke.svg)](https://github.com/ekristen/aws-nuke/blob/main/LICENSE) -[![GitHub release](https://img.shields.io/github/release/ekristen/aws-nuke.svg)](https://github.com/ekristen/aws-nuke/releases) +[![release](https://img.shields.io/github/release/ekristen/aws-nuke.svg)](https://github.com/ekristen/aws-nuke/releases) -Remove all resources from an AWS account. - -**Development Status** *aws-nuke* is stable, but it is likely that not all AWS -resources are covered by it. Be encouraged to add missing resources and create -a Pull Request or to create an [Issue](https://github.com/ekristen/aws-nuke/issues/new). - -## This is a Managed Fork - -**Important:** this is a full fork of the original tool written by the folks -over at [rebuy-de](https://github.com/rebuy-de). This fork became necessary after -attempting to make contributions and respond to issues to learn that the current -maintainers only have time to work on the project about once a month and while -receptive to bringing in other people to help maintain, made it clear it would take -time. Considering the feedback cycle was already weeks on initial comms, I had -to make the hard decision to fork and maintain myself. - -### Plans - -- Tests - would like to get more mock tests and integration tests in place -- Tooling - make it easier to contribute by adding tools to automatically generate - base resources that need to be slightly modified for use. -- Other Clouds - would like to add Azure and GCP (likely rename project at that point) - -## Caution - -Be aware that *aws-nuke* is a very destructive tool, hence you have to be very -careful while using it. Otherwise you might delete production data. - -**We strongly advise you to not run this application on any AWS account, where -you cannot afford to lose all resources.** - -To reduce the blast radius of accidents, there are some safety precautions: - -1. By default *aws-nuke* only lists all nukeable resources. You need to add - `--no-dry-run` to actually delete resources. -2. *aws-nuke* asks you twice to confirm the deletion by entering the account - alias. The first time is directly after the start and the second time after - listing all nukeable resources. -3. To avoid just displaying a account ID, which might gladly be ignored by - humans, it is required to actually set an [Account - Alias](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html) - for your account. Otherwise *aws-nuke* will abort. -4. The Account Alias must not contain the string `prod`. This string is - hardcoded and it is recommended to add it to every actual production account - (eg `mycompany-production-ecr`). -5. The config file contains a blocklist field. If the Account ID of the account - you want to nuke is part of this blocklist, *aws-nuke* will abort. It is - recommended, that you add every production account to this blocklist. -6. To ensure you don't just ignore the blocklisting feature, the blocklist must - contain at least one Account ID. -7. The config file contains account specific settings (eg. filters). The - account you want to nuke must be explicitly listed there. -8. To ensure to not accidentally delete a random account, it is required to - specify a config file. It is recommended to have only a single config file - and add it to a central repository. This way the account blocklist is way - easier to manage and keep up to date. - -Feel free to create an issue, if you have any ideas to improve the safety -procedures. - -## Use Cases - -- We are testing our [Terraform](https://www.terraform.io/) code with Jenkins. - Sometimes a Terraform run fails during development and messes up the account. - With *aws-nuke* we can simply clean up the failed account so it can be reused - for the next build. -- Our platform developers have their own AWS Accounts where they can create - their own Kubernetes clusters for testing purposes. With *aws-nuke* it is - very easy to clean up these account at the end of the day and keep the costs - low. - -## Releases - -We usually release a new version once enough changes came together and have -been tested for a while. +**Forked from [rebuy-de/aws-nuke](https://github.com/rebuy-de/aws-nuke)** -You can find Linux, macOS and Windows binaries on the [releases page](https://github.com/ekristen/aws-nuke/releases), -but we also provide containerized versions on [ghcr.io/ekristen/aws-nuke](https://ghcr.io/ekristen/aws-nuke) -and [docker.io/ekristen/aws-nuke](https://hub.docker.com/r/ekristen/aws-nuke). Both -are available for multiple architectures (amd64, arm64 & armv7) using Docker manifests. You can reference -the main tag on any system and get the correct docker image automatically. - -## Usage - -At first you need to create a config file for *aws-nuke*. This is a minimal one: - -```yaml -regions: -- eu-west-1 -- global - -account-blocklist: -- "999999999999" # production - -accounts: - "000000000000": {} # aws-nuke-example -``` +## Overview -With this config we can run *aws-nuke*: - -```bash -$ aws-nuke -c config/nuke-config.yml --profile aws-nuke-example -aws-nuke version v1.0.39.gc2f318f - Fri Jul 28 16:26:41 CEST 2017 - c2f318f37b7d2dec0e646da3d4d05ab5296d5bce - -Do you really want to nuke the account with the ID 000000000000 and the alias 'aws-nuke-example'? -Do you want to continue? Enter account alias to continue. -> aws-nuke-example - -eu-west-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - would remove -eu-west-1 - EC2Instance - 'i-01b489457a60298dd' - would remove -eu-west-1 - EC2KeyPair - 'test' - would remove -eu-west-1 - EC2NetworkACL - 'acl-6482a303' - cannot delete default VPC -eu-west-1 - EC2RouteTable - 'rtb-ffe91e99' - would remove -eu-west-1 - EC2SecurityGroup - 'sg-220e945a' - cannot delete group 'default' -eu-west-1 - EC2SecurityGroup - 'sg-f20f958a' - would remove -eu-west-1 - EC2Subnet - 'subnet-154d844e' - would remove -eu-west-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - would remove -eu-west-1 - EC2VPC - 'vpc-c6159fa1' - would remove -eu-west-1 - IAMUserAccessKey - 'my-user -> ABCDEFGHIJKLMNOPQRST' - would remove -eu-west-1 - IAMUserPolicyAttachment - 'my-user -> AdministratorAccess' - [UserName: "my-user", PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess", PolicyName: "AdministratorAccess"] - would remove -eu-west-1 - IAMUser - 'my-user' - would remove -Scan complete: 13 total, 11 nukeable, 2 filtered. - -Would delete these resources. Provide --no-dry-run to actually destroy resources. -``` - -As we see, *aws-nuke* only lists all found resources and exits. This is because -the `--no-dry-run` flag is missing. Also it wants to delete the -administrator. We don't want to do this, because we use this user to access -our account. Therefore we have to extend the config so it ignores this user: - -```yaml -regions: -- eu-west-1 - -account-blocklist: -- "999999999999" # production - -accounts: - "000000000000": # aws-nuke-example - filters: - IAMUser: - - "my-user" - IAMUserPolicyAttachment: - - "my-user -> AdministratorAccess" - IAMUserAccessKey: - - "my-user -> ABCDEFGHIJKLMNOPQRST" -``` - -```bash -$ aws-nuke -c config/nuke-config.yml --profile aws-nuke-example --no-dry-run -aws-nuke version v1.0.39.gc2f318f - Fri Jul 28 16:26:41 CEST 2017 - c2f318f37b7d2dec0e646da3d4d05ab5296d5bce - -Do you really want to nuke the account with the ID 000000000000 and the alias 'aws-nuke-example'? -Do you want to continue? Enter account alias to continue. -> aws-nuke-example - -eu-west-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - would remove -eu-west-1 - EC2Instance - 'i-01b489457a60298dd' - would remove -eu-west-1 - EC2KeyPair - 'test' - would remove -eu-west-1 - EC2NetworkACL - 'acl-6482a303' - cannot delete default VPC -eu-west-1 - EC2RouteTable - 'rtb-ffe91e99' - would remove -eu-west-1 - EC2SecurityGroup - 'sg-220e945a' - cannot delete group 'default' -eu-west-1 - EC2SecurityGroup - 'sg-f20f958a' - would remove -eu-west-1 - EC2Subnet - 'subnet-154d844e' - would remove -eu-west-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - would remove -eu-west-1 - EC2VPC - 'vpc-c6159fa1' - would remove -eu-west-1 - IAMUserAccessKey - 'my-user -> ABCDEFGHIJKLMNOPQRST' - filtered by config -eu-west-1 - IAMUserPolicyAttachment - 'my-user -> AdministratorAccess' - [UserName: "my-user", PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess", PolicyName: "AdministratorAccess"] - would remove -eu-west-1 - IAMUser - 'my-user' - filtered by config -Scan complete: 13 total, 8 nukeable, 5 filtered. - -Do you really want to nuke these resources on the account with the ID 000000000000 and the alias 'aws-nuke-example'? -Do you want to continue? Enter account alias to continue. -> aws-nuke-example - -eu-west-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - failed -eu-west-1 - EC2Instance - 'i-01b489457a60298dd' - triggered remove -eu-west-1 - EC2KeyPair - 'test' - triggered remove -eu-west-1 - EC2RouteTable - 'rtb-ffe91e99' - failed -eu-west-1 - EC2SecurityGroup - 'sg-f20f958a' - failed -eu-west-1 - EC2Subnet - 'subnet-154d844e' - failed -eu-west-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - failed -eu-west-1 - EC2VPC - 'vpc-c6159fa1' - failed -eu-west-1 - S3Object - 's3://rebuy-terraform-state-138758637120/run-terraform.lock' - triggered remove - -Removal requested: 2 waiting, 6 failed, 5 skipped, 0 finished - -eu-west-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - failed -eu-west-1 - EC2Instance - 'i-01b489457a60298dd' - waiting -eu-west-1 - EC2KeyPair - 'test' - removed -eu-west-1 - EC2RouteTable - 'rtb-ffe91e99' - failed -eu-west-1 - EC2SecurityGroup - 'sg-f20f958a' - failed -eu-west-1 - EC2Subnet - 'subnet-154d844e' - failed -eu-west-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - failed -eu-west-1 - EC2VPC - 'vpc-c6159fa1' - failed - -Removal requested: 1 waiting, 6 failed, 5 skipped, 1 finished - ---- truncating long output --- -``` - -As you see *aws-nuke* now tries to delete all resources which aren't filtered, -without caring about the dependencies between them. This results in API errors -which can be ignored. These errors are shown at the end of the *aws-nuke* run, -if they keep to appear. +Remove all resources from an AWS account. -*aws-nuke* retries deleting all resources until all specified ones are deleted -or until there are only resources with errors left. +*aws-nuke* is stable, but it is likely that not all AWS resources are covered by it. Be encouraged to add missing +resources and create a Pull Request or to create an [Issue](https://github.com/ekristen/aws-nuke/issues/new). -### AWS Credentials +## Documentation -There are two ways to authenticate *aws-nuke*. There are static credentials and -profiles. The later one can be configured in the shared credentials file (ie -`~/.aws/credentials`) or the shared config file (ie `~/.aws/config`). +All documentation is in the [docs/](docs/) directory and is built using [MkDocs](https://www.mkdocs.org/). However, +all the documentation is hosted at [https://ekristen.github.io/aws-nuke/](https://ekristen.github.io/aws-nuke/). -To use *static credentials* the command line flags `--access-key-id` and -`--secret-access-key` are required. The flag `--session-token` is only required -for temporary sessions. +## History of this Fork -To use *shared profiles* the command line flag `--profile` is required. The -profile must be either defined with static credentials in the [shared -credential -file](https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html) -or in [shared config -file](https://docs.aws.amazon.com/cli/latest/userguide/cli-roles.html) with an -assuming role. +**Important:** this is a full fork of the original tool written by the folks over at [rebuy-de](https://github.com/rebuy-de). +This fork became necessary after attempting to make contributions and respond to issues to learn that the current +maintainers only have time to work on the project about once a month and while receptive to bringing in other +people to help maintain, made it clear it would take time. Considering the feedback cycle was already weeks on +initial communications, I had to make the hard decision to fork and maintain it. -### Using Custom AWS Endpoints +### libnuke -It is possible to configure aws-nuke to run against non-default AWS endpoints. -It could be used for integration testing pointing to a local endpoint such as an -S3 appliance or a Stratoscale cluster for example. +I also needed a version of this tool for Azure and GCP, and initially I just copied and altered the code I needed for +Azure, but I didn't want to have to maintain multiple copies of the same code, so I decided to create +[libnuke](https://github.com/ekristen/libnuke) to abstract all the code that was common between the two tools and write +proper unit tests for it. -To configure aws-nuke to use custom endpoints, add the configuration directives as shown in the following example: +## Version 3 -```yaml -regions: -- demo10 - -# inspired by https://www.terraform.io/docs/providers/aws/guides/custom-service-endpoints.html -endpoints: -- region: demo10 - tls_insecure_skip_verify: true - services: - - service: ec2 - url: https://10.16.145.115/api/v2/aws/ec2 - - service: s3 - url: https://10.16.145.115:1060 - - service: rds - url: https://10.16.145.115/api/v2/aws/rds - - service: elbv2 - url: https://10.16.145.115/api/v2/aws/elbv2 - - service: efs - url: https://10.16.145.115/api/v2/aws/efs - - service: emr - url: https://10.16.145.115/api/v2/aws/emr - - service: autoscaling - url: https://10.16.145.115/api/v2/aws/autoscaling - - service: cloudwatch - url: https://10.16.145.115/api/v2/aws/cloudwatch - - service: sns - url: https://10.16.145.115/api/v2/aws/sns - - service: iam - url: https://10.16.145.115/api/v2/aws/iam - - service: acm - url: https://10.16.145.115/api/v2/aws/acm - -account-blocklist: -- "account-id-of-custom-region-prod" # production - -accounts: - "account-id-of-custom-region-demo10": -``` +Version 3 is a rewrite of this tool using [libnuke](https://github.com/ekristen/libnuke) with a focus on improving a +number of the outstanding things that I couldn't get done with the original project without separating out the core +code into a library. -This can then be used as follows: - -```log -$ aws-nuke -c config/my.yaml --access-key-id --secret-access-key --default-region demo10 -aws-nuke version v2.11.0.2.gf0ad3ac.dirty - Tue Nov 26 19:15:12 IST 2019 - f0ad3aca55eb66b93b88ce2375f8ad06a7ca856f - -Do you really want to nuke the account with the ID account-id-of-custom-region-demo10 and the alias 'account-id-of-custom-region-demo10'? -Do you want to continue? Enter account alias to continue. -> account-id-of-custom-region-demo10 - -demo10 - EC2Volume - vol-099aa1bb08454fd5bc3499897f175fd8 - [tag:Name: "volume_of_5559b38e-0a56-4078-9a6f-eb446c21cadf"] - would remove -demo10 - EC2Volume - vol-11e9b09c71924354bcb4ee77e547e7db - [tag:Name: "volume_of_e4f8c806-0235-4578-8c08-dce45d4c2952"] - would remove -demo10 - EC2Volume - vol-1a10cb3f3119451997422c435abf4275 - [tag:Name: "volume-dd2e4c4a"] - would remove -demo10 - EC2Volume - vol-1a2e649df1ef449686ef8771a078bb4e - [tag:Name: "web-server-5"] - would remove -demo10 - EC2Volume - vol-481d09bbeb334ec481c12beee6f3012e - [tag:Name: "volume_of_15b606ce-9dcd-4573-b7b1-4329bc236726"] - would remove -demo10 - EC2Volume - vol-48f6bd2bebb945848b029c80b0f2de02 - [tag:Name: "Data volume for 555e9f8a"] - would remove -demo10 - EC2Volume - vol-49f0762d84f0439da805d11b6abc1fee - [tag:Name: "Data volume for acb7f3a5"] - would remove -demo10 - EC2Volume - vol-4c34656f823542b2837ac4eaff64762b - [tag:Name: "wpdb"] - would remove -demo10 - EC2Volume - vol-875f091078134fee8d1fe3b1156a4fce - [tag:Name: "volume-f1a7c95f"] - would remove -demo10 - EC2Volume - vol-8776a0d5bd4e4aefadfa8038425edb20 - [tag:Name: "web-server-6"] - would remove -demo10 - EC2Volume - vol-8ed468bfab0b42c3bc617479b8f33600 - [tag:Name: "web-server-3"] - would remove -demo10 - EC2Volume - vol-94e0370b6ab54f03822095d74b7934b2 - [tag:Name: "web-server-2"] - would remove -demo10 - EC2Volume - vol-9ece34dfa7f64dd583ab903a1273340c - [tag:Name: "volume-4ccafc2e"] - would remove -demo10 - EC2Volume - vol-a3fb3e8800c94452aff2fcec7f06c26b - [tag:Name: "web-server-0"] - would remove -demo10 - EC2Volume - vol-a53954e17cb749a283d030f26bbaf200 - [tag:Name: "volume-5484e330"] - would remove -demo10 - EC2Volume - vol-a7afe64f4d0f4965a6703cc0cfab2ba4 - [tag:Name: "Data volume for f1a7c95f"] - would remove -demo10 - EC2Volume - vol-d0bc3f2c887f4072a9fda0b8915d94c1 - [tag:Name: "physical_volume_of_39c29f53-eac4-4f02-9781-90512cc7c563"] - would remove -demo10 - EC2Volume - vol-d1f066d8dac54ae59d087d7e9947e8a9 - [tag:Name: "Data volume for 4ccafc2e"] - would remove -demo10 - EC2Volume - vol-d9adb3f084cd4d588baa08690349b1f9 - [tag:Name: "volume_of_84854c9b-98aa-4f5b-926a-38b3398c3ad2"] - would remove -demo10 - EC2Volume - vol-db42e471b19f42b7835442545214bc1a - [tag:Name: "lb-tf-lb-20191126090616258000000002"] - would remove -demo10 - EC2Volume - vol-db80932fb47243efa67c9dd34223c647 - [tag:Name: "web-server-5"] - would remove -demo10 - EC2Volume - vol-dbea1d1083654d30a43366807a125aed - [tag:Name: "volume-555e9f8a"] - would remove - ---- truncating long output --- -``` +### Changes -### Specifying Resource Types to Delete +- The root command will result in help now on v3, the primary nuke command moved to `nuke`. +- CloudFormation Stacks now support a hold and wait for parent deletion process. +- Nested CloudFormation Stacks are now eligible for deletion and no longer omitted. +- The entire resource lister format has changed and requires a struct. +- Context is passed throughout the entire library now, including the listing function and the removal function. -*aws-nuke* deletes a lot of resources and there might be added more at any -release. Eventually, every resources should get deleted. You might want to -restrict which resources to delete. There are multiple ways to configure this. +### Goals -One way are filters, which already got mentioned. This requires to know the -identifier of each resource. It is also possible to prevent whole resource -types (eg `S3Bucket`) from getting deleted with two methods. +- Adding additional tests +- Adding additional resources +- Adding Documentation for adding resources and using the tool +- Consider adding DAG for dependencies between resource types and individual resources + - This will improve the process of deleting resources that have dependencies on other resources and reduce + errors and unnecessary API calls. -- The `--target` flag limits nuking to the specified resource types. -- The `--exclude` flag prevent nuking of the specified resource types. +## Documentation -It is also possible to configure the resource types in the config file like in -these examples: +The project is built to have the documentation right alongside the code in the `docs/` directory leveraging +[Material for Mkdocs](https://squidfunk.github.io/mkdocs-material/) -```yaml ---- -regions: - - "eu-west-1" -account-blocklist: -- 1234567890 - -resource-types: - # only nuke these three resources - targets: - - S3Object - - S3Bucket - - IAMRole - -accounts: - 555133742: {} -``` +In the root of the project exists mkdocs.yml which drives the configuration for the documentation. -```yaml ---- -regions: - - "eu-west-1" -account-blocklist: -- 1234567890 - -resource-types: - # don't nuke IAM users - excludes: - - IAMUser - -accounts: - 555133742: {} -``` +This README.md is currently copied to `docs/index.md` and the documentation is automatically published to the GitHub +pages location for this repository using a GitHub Action workflow. It does not use the `gh-pages` branch. -If targets are specified in multiple places (eg CLI and account specific), then -a resource type must be specified in all places. In other words each -configuration limits the previous ones. -If an exclude is used, then all its resource types will not be deleted. +## Use Cases -**Hint:** You can see all available resource types with this command: +- We are testing our [Terraform](https://www.terraform.io/) code with Jenkins. Sometimes a Terraform run fails during development and + messes up the account. With *aws-nuke* we can simply clean up the failed account, so it can be reused for the next + build. +- Our platform developers have their own AWS Accounts where they can create their own Kubernetes clusters for testing + purposes. With *aws-nuke* it is very easy to clean up these account at the end of the day and keep the costs low. -```bash -aws-nuke resource-types -``` ### Feature Flags @@ -392,263 +91,6 @@ feature-flags: force-delete-lightsail-addons: true ``` -### Filtering Resources - -It is possible to filter this is important for not deleting the current user -for example or for resources like S3 Buckets which have a globally shared -namespace and might be hard to recreate. Currently the filtering is based on -the resource identifier. The identifier will be printed as the first step of -*aws-nuke* (eg `i-01b489457a60298dd` for an EC2 instance). - -**Note: Even with filters you should not run aws-nuke on any AWS account, where -you cannot afford to lose all resources. It is easy to make mistakes in the -filter configuration. Also, since aws-nuke is in continous development, there -is always a possibility to introduce new bugs, no matter how careful we review -new code.** - -The filters are part of the account-specific configuration and are grouped by -resource types. This is an example of a config that deletes all resources but -the `admin` user with its access permissions and two access keys: - -```yaml ---- -regions: -- global -- eu-west-1 - -account-blocklist: -- 1234567890 - -accounts: - 0987654321: - filters: - IAMUser: - - "admin" - IAMUserPolicyAttachment: - - "admin -> AdministratorAccess" - IAMUserAccessKey: - - "admin -> AKSDAFRETERSDF" - - "admin -> AFGDSGRTEWSFEY" -``` - -Any resource whose resource identifier exactly matches any of the filters in -the list will be skipped. These will be marked as "filtered by config" on the -*aws-nuke* run. - -#### Filter Properties - -Some resources support filtering via properties. When a resource support these -properties, they will be listed in the output like in this example: - -```log -global - IAMUserPolicyAttachment - 'admin -> AdministratorAccess' - [RoleName: "admin", PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess", PolicyName: "AdministratorAccess"] - would remove -``` - -To use properties, it is required to specify a object with `properties` and -`value` instead of the plain string. - -These types can be used to simplify the configuration. For example, it is -possible to protect all access keys of a single user: - -```yaml -IAMUserAccessKey: -- property: UserName - value: "admin" -``` - -#### Filter Types - -There are also additional comparision types than an exact match: - -- `exact` – The identifier must exactly match the given string. This is the default. -- `contains` – The identifier must contain the given string. -- `glob` – The identifier must match against the given [glob - pattern](https://en.wikipedia.org/wiki/Glob_(programming)). This means the - string might contains wildcards like `*` and `?`. Note that globbing is - designed for file paths, so the wildcards do not match the directory - separator (`/`). Details about the glob pattern can be found in the [library - documentation](https://godoc.org/github.com/mb0/glob). -- `regex` – The identifier must match against the given regular expression. - Details about the syntax can be found in the [library - documentation](https://golang.org/pkg/regexp/syntax/). -- `dateOlderThan` - The identifier is parsed as a timestamp. After the offset is added - to it (specified in the `value` field), the resulting timestamp must be AFTER the - current time. Details on offset syntax can be found in the [library documentation](https://golang.org/pkg/time/#ParseDuration). - Supported date formats are epoch time, `2006-01-02`, `2006/01/02`, `2006-01-02T15:04:05Z`, - `2006-01-02T15:04:05.999999999Z07:00`, and `2006-01-02T15:04:05Z07:00`. - -To use a non-default comparision type, it is required to specify an object with -`type` and `value` instead of the plain string. - -These types can be used to simplify the configuration. For example, it is -possible to protect all access keys of a single user by using `glob`: - -```yaml -IAMUserAccessKey: -- type: glob - value: "admin -> *" -``` - -#### Using Them Together - -It is also possible to use Filter Properties and Filter Types together. For -example to protect all Hosted Zone of a specific TLD: - -```yaml -Route53HostedZone: -- property: Name - type: glob - value: "*.rebuy.cloud." -``` - -#### Inverting Filter Results - -Any filter result can be inverted by using `invert: true`, for example: - -```yaml -CloudFormationStack: -- property: Name - value: "foo" - invert: true -``` - -In this case *any* CloudFormationStack ***but*** the ones called "foo" will be -filtered. Be aware that *aws-nuke* internally takes every resource and applies -every filter on it. If a filter matches, it marks the node as filtered. - -#### Filter Presets - -It might be the case that some filters are the same across multiple accounts. -This especially could happen, if provisioning tools like Terraform are used or -if IAM resources follow the same pattern. - -For this case *aws-nuke* supports presets of filters, that can applied on -multiple accounts. A configuration could look like this: - -```yaml ---- -regions: -- "global" -- "eu-west-1" - -account-blocklist: -- 1234567890 - -accounts: - 555421337: - presets: - - "common" - 555133742: - presets: - - "common" - - "terraform" - 555134237: - presets: - - "common" - - "terraform" - filters: - EC2KeyPair: - - "notebook" - -presets: - terraform: - filters: - S3Bucket: - - type: glob - value: "my-statebucket-*" - DynamoDBTable: - - "terraform-lock" - common: - filters: - IAMRole: - - "OrganizationAccountAccessRole" -``` - -## Install - -### For macOS -`brew install aws-nuke` - -### Use Released Binaries - -The easiest way of installing it, is to download the latest -[release](https://github.com/ekristen/aws-nuke/releases) from GitHub. - -#### Example for Linux Intel/AMD - -Download and extract - -```bash -wget -c https://github.com/rebuy-de/aws-nuke/releases/download/v2.16.0/aws-nuke-v2.16.0-linux-amd64.tar.gz -O - | sudo tar -xz -C $HOME/bin -``` - -Run - -```bash -aws-nuke-v2.16.0-linux-amd64 -``` - -### Compile from Source - -To compile *aws-nuke* from source you need a working -[Golang](https://golang.org/doc/install) development environment. - -*aws-nuke* uses go modules and so the clone path should no matter. - -The easiest way to compile is by using [goreleaser](https://goreleaser.io) - -```bash -goreleaser --rm-dist --snapshot --single-target -``` - -**Note:** this will automatically build for your current architecture and place the result -in the releases directory. - -You may also use `make` to compile the binary, this was left over from before the fork. - -Also you need to install [golint](https://github.com/golang/lint/) and [GNU -Make](https://www.gnu.org/software/make/). - -Then you just need to run `make build` to compile a binary into the project -directory or `make install` go install *aws-nuke* into `$GOPATH/bin`. With -`make xc` you can cross compile *aws-nuke* for other platforms. - -### Docker - -You can run *aws-nuke* with Docker by using a command like this: - -```bash -$ docker run \ - --rm -it \ - -v /full-path/to/nuke-config.yml:/home/aws-nuke/config.yml \ - -v /home/user/.aws:/home/aws-nuke/.aws \ - ghcr.io/ekristen/aws-nuke \ - --profile default \ - --config /home/aws-nuke/config.yml -``` - -To make it work, you need to adjust the paths for the AWS config and the -*aws-nuke* config. - -Also you need to specify the correct AWS profile. Instead of mounting the AWS -directory, you can use the `--access-key-id` and `--secret-access-key` flags. - -Make sure you use the latest version in the image tag. Alternatiely you can use -`main` for the latest development version, but be aware that this is more -likely to break at any time. - -## Testing - -### Unit Tests - -To unit test *aws-nuke*, some tests require [gomock](https://github.com/golang/mock) to run. -This will run via `go generate ./...`, but is automatically run via `make test`. -To run the unit tests: - -```bash -make test -``` - ## Contact Channels For now GitHub issues, may open a Slack or Discord if warranted. diff --git a/cmd/log.go b/cmd/log.go deleted file mode 100644 index e99410a5f..000000000 --- a/cmd/log.go +++ /dev/null @@ -1,62 +0,0 @@ -package cmd - -import ( - "fmt" - "sort" - "strings" - - "github.com/fatih/color" - "github.com/rebuy-de/aws-nuke/v2/resources" -) - -var ( - ReasonSkip = *color.New(color.FgYellow) - ReasonError = *color.New(color.FgRed) - ReasonRemoveTriggered = *color.New(color.FgGreen) - ReasonWaitPending = *color.New(color.FgBlue) - ReasonSuccess = *color.New(color.FgGreen) -) - -var ( - ColorRegion = *color.New(color.Bold) - ColorResourceType = *color.New() - ColorResourceID = *color.New(color.Bold) - ColorResourceProperties = *color.New(color.Italic) -) - -// Format the resource properties in sorted order ready for printing. -// This ensures that multiple runs of aws-nuke produce stable output so -// that they can be compared with each other. -func Sorted(m map[string]string) string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - sorted := make([]string, 0, len(m)) - for k := range keys { - sorted = append(sorted, fmt.Sprintf("%s: \"%s\"", keys[k], m[keys[k]])) - } - return fmt.Sprintf("[%s]", strings.Join(sorted, ", ")) -} - -func Log(region *Region, resourceType string, r resources.Resource, c color.Color, msg string) { - ColorRegion.Printf("%s", region.Name) - fmt.Printf(" - ") - ColorResourceType.Print(resourceType) - fmt.Printf(" - ") - - rString, ok := r.(resources.LegacyStringer) - if ok { - ColorResourceID.Print(rString.String()) - fmt.Printf(" - ") - } - - rProp, ok := r.(resources.ResourcePropertyGetter) - if ok { - ColorResourceProperties.Print(Sorted(rProp.Properties())) - fmt.Printf(" - ") - } - - c.Printf("%s\n", msg) -} diff --git a/cmd/nuke.go b/cmd/nuke.go deleted file mode 100644 index fc6d958bc..000000000 --- a/cmd/nuke.go +++ /dev/null @@ -1,318 +0,0 @@ -package cmd - -import ( - "fmt" - "time" - - "github.com/rebuy-de/aws-nuke/v2/pkg/awsutil" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/rebuy-de/aws-nuke/v2/resources" - "github.com/sirupsen/logrus" -) - -type Nuke struct { - Parameters NukeParameters - Account awsutil.Account - Config *config.Nuke - - ResourceTypes types.Collection - - items Queue -} - -func NewNuke(params NukeParameters, account awsutil.Account) *Nuke { - n := Nuke{ - Parameters: params, - Account: account, - } - - return &n -} - -func (n *Nuke) Run() error { - var err error - - if n.Parameters.ForceSleep < 3 && n.Parameters.NoDryRun { - return fmt.Errorf("Value for --force-sleep cannot be less than 3 seconds if --no-dry-run is set. This is for your own protection.") - } - forceSleep := time.Duration(n.Parameters.ForceSleep) * time.Second - - fmt.Printf("aws-nuke version %s - %s - %s\n\n", BuildVersion, BuildDate, BuildHash) - - err = n.Config.ValidateAccount(n.Account.ID(), n.Account.Aliases()) - if err != nil { - return err - } - - fmt.Printf("Do you really want to nuke the account with "+ - "the ID %s and the alias '%s'?\n", n.Account.ID(), n.Account.Alias()) - if n.Parameters.Force { - fmt.Printf("Waiting %v before continuing.\n", forceSleep) - time.Sleep(forceSleep) - } else { - fmt.Printf("Do you want to continue? Enter account alias to continue.\n") - err = Prompt(n.Account.Alias()) - if err != nil { - return err - } - } - - err = n.Scan() - if err != nil { - return err - } - - if n.items.Count(ItemStateNew) == 0 { - fmt.Println("No resource to delete.") - return nil - } - - if !n.Parameters.NoDryRun { - fmt.Println("The above resources would be deleted with the supplied configuration. Provide --no-dry-run to actually destroy resources.") - return nil - } - - fmt.Printf("Do you really want to nuke these resources on the account with "+ - "the ID %s and the alias '%s'?\n", n.Account.ID(), n.Account.Alias()) - if n.Parameters.Force { - fmt.Printf("Waiting %v before continuing.\n", forceSleep) - time.Sleep(forceSleep) - } else { - fmt.Printf("Do you want to continue? Enter account alias to continue.\n") - err = Prompt(n.Account.Alias()) - if err != nil { - return err - } - } - - failCount := 0 - waitingCount := 0 - - for { - n.HandleQueue() - - if n.items.Count(ItemStatePending, ItemStateWaiting, ItemStateNew) == 0 && n.items.Count(ItemStateFailed) > 0 { - if failCount >= 2 { - logrus.Errorf("There are resources in failed state, but none are ready for deletion, anymore.") - fmt.Println() - - for _, item := range n.items { - if item.State != ItemStateFailed { - continue - } - - item.Print() - logrus.Error(item.Reason) - } - - return fmt.Errorf("failed") - } - - failCount = failCount + 1 - } else { - failCount = 0 - } - if n.Parameters.MaxWaitRetries != 0 && n.items.Count(ItemStateWaiting, ItemStatePending) > 0 && n.items.Count(ItemStateNew) == 0 { - if waitingCount >= n.Parameters.MaxWaitRetries { - return fmt.Errorf("Max wait retries of %d exceeded.\n\n", n.Parameters.MaxWaitRetries) - } - waitingCount = waitingCount + 1 - } else { - waitingCount = 0 - } - if n.items.Count(ItemStateNew, ItemStatePending, ItemStateFailed, ItemStateWaiting) == 0 { - break - } - - time.Sleep(5 * time.Second) - } - - fmt.Printf("Nuke complete: %d failed, %d skipped, %d finished.\n\n", - n.items.Count(ItemStateFailed), n.items.Count(ItemStateFiltered), n.items.Count(ItemStateFinished)) - - return nil -} - -func (n *Nuke) Scan() error { - accountConfig := n.Config.Accounts[n.Account.ID()] - - resourceTypes := ResolveResourceTypes( - resources.GetListerNames(), - resources.GetCloudControlMapping(), - []types.Collection{ - n.Parameters.Targets, - n.Config.ResourceTypes.Targets, - accountConfig.ResourceTypes.Targets, - }, - []types.Collection{ - n.Parameters.Excludes, - n.Config.ResourceTypes.Excludes, - accountConfig.ResourceTypes.Excludes, - }, - []types.Collection{ - n.Parameters.CloudControl, - n.Config.ResourceTypes.CloudControl, - accountConfig.ResourceTypes.CloudControl, - }, - ) - - queue := make(Queue, 0) - - for _, regionName := range n.Config.Regions { - region := NewRegion(regionName, n.Account.ResourceTypeToServiceType, n.Account.NewSession) - - items := Scan(region, resourceTypes) - for item := range items { - ffGetter, ok := item.Resource.(resources.FeatureFlagGetter) - if ok { - ffGetter.FeatureFlags(n.Config.FeatureFlags) - } - - queue = append(queue, item) - err := n.Filter(item) - if err != nil { - return err - } - - if item.State != ItemStateFiltered || !n.Parameters.Quiet { - item.Print() - } - } - } - - fmt.Printf("Scan complete: %d total, %d nukeable, %d filtered.\n\n", - queue.CountTotal(), queue.Count(ItemStateNew), queue.Count(ItemStateFiltered)) - - n.items = queue - - return nil -} - -func (n *Nuke) Filter(item *Item) error { - - checker, ok := item.Resource.(resources.Filter) - if ok { - err := checker.Filter() - if err != nil { - item.State = ItemStateFiltered - item.Reason = err.Error() - - // Not returning the error, since it could be because of a failed - // request to the API. We do not want to block the whole nuking, - // because of an issue on AWS side. - return nil - } - } - - accountFilters, err := n.Config.Filters(n.Account.ID()) - if err != nil { - return err - } - - itemFilters, ok := accountFilters[item.Type] - if !ok { - return nil - } - - for _, filter := range itemFilters { - prop, err := item.GetProperty(filter.Property) - if err != nil { - logrus.Warnf(err.Error()) - continue - } - match, err := filter.Match(prop) - if err != nil { - return err - } - - if IsTrue(filter.Invert) { - match = !match - } - - if match { - item.State = ItemStateFiltered - item.Reason = "filtered by config" - return nil - } - } - - return nil -} - -func (n *Nuke) HandleQueue() { - listCache := make(map[string]map[string][]resources.Resource) - - for _, item := range n.items { - switch item.State { - case ItemStateNew: - n.HandleRemove(item) - item.Print() - case ItemStateFailed: - n.HandleRemove(item) - n.HandleWait(item, listCache) - item.Print() - case ItemStatePending: - n.HandleWait(item, listCache) - item.State = ItemStateWaiting - item.Print() - case ItemStateWaiting: - n.HandleWait(item, listCache) - item.Print() - } - - } - - fmt.Println() - fmt.Printf("Removal requested: %d waiting, %d failed, %d skipped, %d finished\n\n", - n.items.Count(ItemStateWaiting, ItemStatePending), n.items.Count(ItemStateFailed), - n.items.Count(ItemStateFiltered), n.items.Count(ItemStateFinished)) -} - -func (n *Nuke) HandleRemove(item *Item) { - err := item.Resource.Remove() - if err != nil { - item.State = ItemStateFailed - item.Reason = err.Error() - return - } - - item.State = ItemStatePending - item.Reason = "" -} - -func (n *Nuke) HandleWait(item *Item, cache map[string]map[string][]resources.Resource) { - var err error - region := item.Region.Name - _, ok := cache[region] - if !ok { - cache[region] = map[string][]resources.Resource{} - } - left, ok := cache[region][item.Type] - if !ok { - left, err = item.List() - if err != nil { - item.State = ItemStateFailed - item.Reason = err.Error() - return - } - cache[region][item.Type] = left - } - - for _, r := range left { - if item.Equals(r) { - checker, ok := r.(resources.Filter) - if ok { - err := checker.Filter() - if err != nil { - break - } - } - - return - } - } - - item.State = ItemStateFinished - item.Reason = "" -} diff --git a/cmd/params.go b/cmd/params.go deleted file mode 100644 index b1583aedd..000000000 --- a/cmd/params.go +++ /dev/null @@ -1,29 +0,0 @@ -package cmd - -import ( - "fmt" - "strings" -) - -type NukeParameters struct { - ConfigPath string - - Targets []string - Excludes []string - CloudControl []string - - NoDryRun bool - Force bool - ForceSleep int - Quiet bool - - MaxWaitRetries int -} - -func (p *NukeParameters) Validate() error { - if strings.TrimSpace(p.ConfigPath) == "" { - return fmt.Errorf("You have to specify the --config flag.\n") - } - - return nil -} diff --git a/cmd/queue.go b/cmd/queue.go deleted file mode 100644 index 6b120c1c3..000000000 --- a/cmd/queue.go +++ /dev/null @@ -1,122 +0,0 @@ -package cmd - -import ( - "fmt" - - "github.com/rebuy-de/aws-nuke/v2/resources" -) - -type ItemState int - -// States of Items based on the latest request to AWS. -const ( - ItemStateNew ItemState = iota - ItemStatePending - ItemStateWaiting - ItemStateFailed - ItemStateFiltered - ItemStateFinished -) - -// An Item describes an actual AWS resource entity with the current state and -// some metadata. -type Item struct { - Resource resources.Resource - - State ItemState - Reason string - - Region *Region - Type string -} - -func (i *Item) Print() { - switch i.State { - case ItemStateNew: - Log(i.Region, i.Type, i.Resource, ReasonWaitPending, "would remove") - case ItemStatePending: - Log(i.Region, i.Type, i.Resource, ReasonWaitPending, "triggered remove") - case ItemStateWaiting: - Log(i.Region, i.Type, i.Resource, ReasonWaitPending, "waiting") - case ItemStateFailed: - Log(i.Region, i.Type, i.Resource, ReasonError, "failed") - case ItemStateFiltered: - Log(i.Region, i.Type, i.Resource, ReasonSkip, i.Reason) - case ItemStateFinished: - Log(i.Region, i.Type, i.Resource, ReasonSuccess, "removed") - } -} - -// List gets all resource items of the same resource type like the Item. -func (i *Item) List() ([]resources.Resource, error) { - lister := resources.GetLister(i.Type) - sess, err := i.Region.Session(i.Type) - if err != nil { - return nil, err - } - return lister(sess) -} - -func (i *Item) GetProperty(key string) (string, error) { - if key == "" { - stringer, ok := i.Resource.(resources.LegacyStringer) - if !ok { - return "", fmt.Errorf("%T does not support legacy IDs", i.Resource) - } - return stringer.String(), nil - } - - getter, ok := i.Resource.(resources.ResourcePropertyGetter) - if !ok { - return "", fmt.Errorf("%T does not support custom properties", i.Resource) - } - - return getter.Properties().Get(key), nil -} - -func (i *Item) Equals(o resources.Resource) bool { - iType := fmt.Sprintf("%T", i.Resource) - oType := fmt.Sprintf("%T", o) - if iType != oType { - return false - } - - iStringer, iOK := i.Resource.(resources.LegacyStringer) - oStringer, oOK := o.(resources.LegacyStringer) - if iOK != oOK { - return false - } - if iOK && oOK { - return iStringer.String() == oStringer.String() - } - - iGetter, iOK := i.Resource.(resources.ResourcePropertyGetter) - oGetter, oOK := o.(resources.ResourcePropertyGetter) - if iOK != oOK { - return false - } - if iOK && oOK { - return iGetter.Properties().Equals(oGetter.Properties()) - } - - return false -} - -type Queue []*Item - -func (q Queue) CountTotal() int { - return len(q) -} - -func (q Queue) Count(states ...ItemState) int { - count := 0 - for _, item := range q { - for _, state := range states { - if item.State == state { - count = count + 1 - break - } - } - } - return count -} diff --git a/cmd/root.go b/cmd/root.go deleted file mode 100644 index 24daa06a1..000000000 --- a/cmd/root.go +++ /dev/null @@ -1,206 +0,0 @@ -package cmd - -import ( - "fmt" - "os" - "sort" - "strings" - - "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/rebuy-de/aws-nuke/v2/pkg/awsutil" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/resources" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -func NewRootCommand() *cobra.Command { - var ( - params NukeParameters - creds awsutil.Credentials - defaultRegion string - verbose bool - logLevel string - ) - - command := &cobra.Command{ - Use: "aws-nuke", - Short: "aws-nuke removes every resource from AWS", - Long: `A tool which removes every resource from an AWS account. Use it with caution, since it cannot distinguish between production and non-production.`, - } - - command.PreRun = func(cmd *cobra.Command, args []string) { - switch strings.ToLower(logLevel) { - case "trace": - log.SetLevel(log.TraceLevel) - case "debug": - log.SetLevel(log.DebugLevel) - case "info": - log.SetLevel(log.InfoLevel) - case "warn": - log.SetLevel(log.WarnLevel) - case "error": - log.SetLevel(log.ErrorLevel) - default: - log.SetLevel(log.InfoLevel) - } - - if verbose { - log.SetLevel(log.DebugLevel) - log.Warn("--verbose CLI argument is deprecated, please use --log-level=debug instead") - } - - log.SetFormatter(&log.TextFormatter{ - EnvironmentOverrideColors: true, - }) - } - - command.RunE = func(cmd *cobra.Command, args []string) error { - var err error - - err = params.Validate() - if err != nil { - return err - } - - if !creds.HasKeys() && !creds.HasProfile() && defaultRegion != "" { - creds.AccessKeyID = os.Getenv("AWS_ACCESS_KEY_ID") - creds.SecretAccessKey = os.Getenv("AWS_SECRET_ACCESS_KEY") - } - err = creds.Validate() - if err != nil { - return err - } - - command.SilenceUsage = true - - config, err := config.Load(params.ConfigPath) - if err != nil { - log.Errorf("Failed to parse config file %s", params.ConfigPath) - return err - } - - if defaultRegion != "" { - awsutil.DefaultRegionID = defaultRegion - switch defaultRegion { - case endpoints.UsEast1RegionID, endpoints.UsEast2RegionID, endpoints.UsWest1RegionID, endpoints.UsWest2RegionID: - awsutil.DefaultAWSPartitionID = endpoints.AwsPartitionID - case endpoints.UsGovEast1RegionID, endpoints.UsGovWest1RegionID: - awsutil.DefaultAWSPartitionID = endpoints.AwsUsGovPartitionID - default: - if config.CustomEndpoints.GetRegion(defaultRegion) == nil { - err = fmt.Errorf("The custom region '%s' must be specified in the configuration 'endpoints'", defaultRegion) - log.Error(err.Error()) - return err - } - } - } - - account, err := awsutil.NewAccount(creds, config.CustomEndpoints) - if err != nil { - return err - } - - n := NewNuke(params, *account) - - n.Config = config - - return n.Run() - } - - command.PersistentFlags().StringVarP( - &logLevel, "log-level", "l", "info", - "Controls log level for output.") - - command.PersistentFlags().BoolVarP( - &verbose, "verbose", "v", false, - "Enables debug output. (Deprecated: use --log-level=debug instead)") - - command.PersistentFlags().StringVarP( - ¶ms.ConfigPath, "config", "c", "", - "(required) Path to the nuke config file.") - - command.PersistentFlags().StringVar( - &creds.Profile, "profile", "", - "Name of the AWS profile name for accessing the AWS API. "+ - "Cannot be used together with --access-key-id and --secret-access-key.") - command.PersistentFlags().StringVar( - &creds.AccessKeyID, "access-key-id", "", - "AWS access key ID for accessing the AWS API. "+ - "Must be used together with --secret-access-key. "+ - "Cannot be used together with --profile.") - command.PersistentFlags().StringVar( - &creds.SecretAccessKey, "secret-access-key", "", - "AWS secret access key for accessing the AWS API. "+ - "Must be used together with --access-key-id. "+ - "Cannot be used together with --profile.") - command.PersistentFlags().StringVar( - &creds.SessionToken, "session-token", "", - "AWS session token for accessing the AWS API. "+ - "Must be used together with --access-key-id and --secret-access-key. "+ - "Cannot be used together with --profile.") - command.PersistentFlags().StringVar( - &creds.AssumeRoleArn, "assume-role-arn", "", - "AWS IAM role arn to assume. "+ - "The credentials provided via --access-key-id or --profile must "+ - "be allowed to assume this role. ") - command.PersistentFlags().StringVar( - &defaultRegion, "default-region", "", - "Custom default region name.") - - command.PersistentFlags().StringSliceVarP( - ¶ms.Targets, "target", "t", []string{}, - "Limit nuking to certain resource types (eg IAMServerCertificate). "+ - "This flag can be used multiple times.") - command.PersistentFlags().StringSliceVarP( - ¶ms.Excludes, "exclude", "e", []string{}, - "Prevent nuking of certain resource types (eg IAMServerCertificate). "+ - "This flag can be used multiple times.") - command.PersistentFlags().StringSliceVar( - ¶ms.CloudControl, "cloud-control", []string{}, - "Nuke given resource via Cloud Control API. "+ - "If there is an old-style method for the same resource, the old-style one will not be executed. "+ - "Note that old-style and cloud-control filters are not compatible! "+ - "This flag can be used multiple times.") - command.PersistentFlags().BoolVar( - ¶ms.NoDryRun, "no-dry-run", false, - "If specified, it actually deletes found resources. "+ - "Otherwise it just lists all candidates.") - command.PersistentFlags().BoolVar( - ¶ms.Force, "force", false, - "Don't ask for confirmation before deleting resources. "+ - "Instead it waits 15s before continuing. Set --force-sleep to change the wait time.") - command.PersistentFlags().IntVar( - ¶ms.ForceSleep, "force-sleep", 15, - "If specified and --force is set, wait this many seconds before deleting resources. "+ - "Defaults to 15.") - command.PersistentFlags().IntVar( - ¶ms.MaxWaitRetries, "max-wait-retries", 0, - "If specified, the program will exit if resources are stuck in waiting for this many iterations. "+ - "0 (default) disables early exit.") - command.PersistentFlags().BoolVarP( - ¶ms.Quiet, "quiet", "q", false, - "Don't show filtered resources.") - - command.AddCommand(NewVersionCommand()) - command.AddCommand(NewResourceTypesCommand()) - - return command -} - -func NewResourceTypesCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "resource-types", - Short: "lists all available resource types", - Run: func(cmd *cobra.Command, args []string) { - names := resources.GetListerNames() - sort.Strings(names) - - for _, resourceType := range names { - fmt.Println(resourceType) - } - }, - } - - return cmd -} diff --git a/cmd/scan.go b/cmd/scan.go deleted file mode 100644 index aa03f51ee..000000000 --- a/cmd/scan.go +++ /dev/null @@ -1,88 +0,0 @@ -package cmd - -import ( - "context" - "fmt" - "runtime/debug" - - "github.com/rebuy-de/aws-nuke/v2/pkg/awsutil" - "github.com/rebuy-de/aws-nuke/v2/pkg/util" - "github.com/rebuy-de/aws-nuke/v2/resources" - log "github.com/sirupsen/logrus" - "golang.org/x/sync/semaphore" -) - -const ScannerParallelQueries = 16 - -func Scan(region *Region, resourceTypes []string) <-chan *Item { - s := &scanner{ - items: make(chan *Item, 100), - semaphore: semaphore.NewWeighted(ScannerParallelQueries), - } - go s.run(region, resourceTypes) - - return s.items -} - -type scanner struct { - items chan *Item - semaphore *semaphore.Weighted -} - -func (s *scanner) run(region *Region, resourceTypes []string) { - ctx := context.Background() - - for _, resourceType := range resourceTypes { - s.semaphore.Acquire(ctx, 1) - go s.list(region, resourceType) - } - - // Wait for all routines to finish. - s.semaphore.Acquire(ctx, ScannerParallelQueries) - - close(s.items) -} - -func (s *scanner) list(region *Region, resourceType string) { - defer func() { - if r := recover(); r != nil { - err := fmt.Errorf("%v\n\n%s", r.(error), string(debug.Stack())) - dump := util.Indent(fmt.Sprintf("%v", err), " ") - log.Errorf("Listing %s failed:\n%s", resourceType, dump) - } - }() - defer s.semaphore.Release(1) - - lister := resources.GetLister(resourceType) - var rs []resources.Resource - sess, err := region.Session(resourceType) - if err == nil { - rs, err = lister(sess) - } - if err != nil { - _, ok := err.(awsutil.ErrSkipRequest) - if ok { - log.Debugf("skipping request: %v", err) - return - } - - _, ok = err.(awsutil.ErrUnknownEndpoint) - if ok { - log.Warnf("skipping request: %v", err) - return - } - - dump := util.Indent(fmt.Sprintf("%v", err), " ") - log.Errorf("Listing %s failed:\n%s", resourceType, dump) - return - } - - for _, r := range rs { - s.items <- &Item{ - Region: region, - Resource: r, - State: ItemStateNew, - Type: resourceType, - } - } -} diff --git a/cmd/util_test.go b/cmd/util_test.go deleted file mode 100644 index bb844b3f5..000000000 --- a/cmd/util_test.go +++ /dev/null @@ -1,95 +0,0 @@ -package cmd - -import ( - "fmt" - "sort" - "testing" - - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) - -func TestResolveResourceTypes(t *testing.T) { - cases := []struct { - name string - base types.Collection - mapping map[string]string - include []types.Collection - exclude []types.Collection - cloudControl []types.Collection - result types.Collection - }{ - { - base: types.Collection{"a", "b", "c", "d"}, - include: []types.Collection{{"a", "b", "c"}}, - result: types.Collection{"a", "b", "c"}, - }, - { - base: types.Collection{"a", "b", "c", "d"}, - exclude: []types.Collection{{"b", "d"}}, - result: types.Collection{"a", "c"}, - }, - { - base: types.Collection{"a", "b"}, - include: []types.Collection{{}}, - result: types.Collection{"a", "b"}, - }, - { - base: types.Collection{"c", "b"}, - exclude: []types.Collection{{}}, - result: types.Collection{"c", "b"}, - }, - { - base: types.Collection{"a", "b", "c", "d"}, - include: []types.Collection{{"a", "b", "c"}}, - exclude: []types.Collection{{"a"}}, - result: types.Collection{"b", "c"}, - }, - { - name: "CloudControlAdd", - base: types.Collection{"a", "b"}, - cloudControl: []types.Collection{{"x"}}, - result: types.Collection{"a", "b", "x"}, - }, - { - name: "CloudControlReplaceOldStyle", - base: types.Collection{"a", "b", "c"}, - mapping: map[string]string{"z": "b"}, - cloudControl: []types.Collection{{"z"}}, - result: types.Collection{"a", "z", "c"}, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - r := ResolveResourceTypes(tc.base, tc.mapping, tc.include, tc.exclude, tc.cloudControl) - - sort.Strings(r) - sort.Strings(tc.result) - - var ( - want = fmt.Sprint(tc.result) - have = fmt.Sprint(r) - ) - - if want != have { - t.Fatalf("Wrong result. Want: %s. Have: %s", want, have) - } - }) - } -} - -func TestIsTrue(t *testing.T) { - falseStrings := []string{"", "false", "treu", "foo"} - for _, fs := range falseStrings { - if IsTrue(fs) { - t.Fatalf("IsTrue falsely returned 'true' for: %s", fs) - } - } - - trueStrings := []string{"true", " true", "true ", " TrUe "} - for _, ts := range trueStrings { - if !IsTrue(ts) { - t.Fatalf("IsTrue falsely returned 'false' for: %s", ts) - } - } -} diff --git a/cmd/version.go b/cmd/version.go deleted file mode 100644 index a4479752d..000000000 --- a/cmd/version.go +++ /dev/null @@ -1,35 +0,0 @@ -package cmd - -import ( - "fmt" - "runtime/debug" - - "github.com/spf13/cobra" -) - -var ( - BuildVersion = "unknown" - BuildDate = "unknown" - BuildHash = "unknown" - BuildEnvironment = "unknown" -) - -func NewVersionCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "version", - Short: "shows version of this application", - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("version: %s\n", BuildVersion) - fmt.Printf("build date: %s\n", BuildDate) - fmt.Printf("scm hash: %s\n", BuildHash) - fmt.Printf("environment: %s\n", BuildEnvironment) - - bi, ok := debug.ReadBuildInfo() - if ok && bi != nil { - fmt.Printf("go version: %s\n", bi.GoVersion) - } - }, - } - - return cmd -} diff --git a/config.yml b/config.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/config/custom-example.yaml b/config/custom-example.yaml deleted file mode 100644 index 219ac393a..000000000 --- a/config/custom-example.yaml +++ /dev/null @@ -1,62 +0,0 @@ -regions: -- demo10 - -# inspired by https://www.terraform.io/docs/providers/aws/guides/custom-service-endpoints.html -endpoints: -- region: demo10 - tls_insecure_skip_verify: true - services: - - service: ec2 - url: https://demo10.cloud.internal/api/v2/aws/ec2 - - service: s3 - url: https://demo10.cloud.internal:1060 - - service: rds - url: https://demo10.cloud.internal/api/v2/aws/rds - - service: elbv2 - url: https://demo10.cloud.internal/api/v2/aws/elbv2 - - service: efs - url: https://demo10.cloud.internal/api/v2/aws/efs - - service: emr - url: https://demo10.cloud.internal/api/v2/aws/emr - - service: autoscaling - url: https://demo10.cloud.internal/api/v2/aws/autoscaling - - service: cloudwatch - url: https://demo10.cloud.internal/api/v2/aws/cloudwatch - - service: sns - url: https://demo10.cloud.internal/api/v2/aws/sns - - service: iam - url: https://demo10.cloud.internal/api/v2/aws/iam - - service: acm - url: https://demo10.cloud.internal/api/v2/aws/acm - -account-blocklist: -- "account-id-of-custom-region-prod" # production - -accounts: - "account-id-of-custom-region-demo10": - presets: - - stratoscale - -presets: - stratoscale: - filters: - EC2VPC: - - property: tag:Name - type: contains - value: "Default VPC" - EC2Instance: - - property: tag:Name - type: contains - value: "DNS VM for vpc" - EC2Volume: - - property: tag:Name - type: contains - value: "DNS VM for vpc" - RDSDBParameterGroup: - - type: regex - value: "^default-" - EC2DHCPOption: - - property: tag:Name - type: regex - value: "^.+$" - invert: true diff --git a/config/example.yaml b/config/example.yaml deleted file mode 100644 index caa2e734a..000000000 --- a/config/example.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -regions: -- "global" # This is for all global resource types e.g. IAM -- "eu-west-1" - -account-blocklist: -- 1234567890 - -# optional: restrict nuking to these resources -resource-types: - targets: - - IAMUser - - IAMUserPolicyAttachment - - IAMUserAccessKey - - S3Bucket - - S3Object - - Route53HostedZone - - EC2Instance - - CloudFormationStack - - MSKCluster - -accounts: - 555133742: - filters: - IAMUser: - - "admin" - IAMUserPolicyAttachment: - - property: RoleName - value: "admin" - IAMUserAccessKey: - - property: UserName - value: "admin" - S3Bucket: - - "s3://my-bucket" - S3Object: - - type: "glob" - value: "s3://my-bucket/**" - Route53HostedZone: - - property: Name - type: "glob" - value: "*.zone.loc." - CloudFormationStack: - - property: "tag:team" - value: "myTeam" - EC2Snapshot: - - property: "tag:team" - type: regex - value: ".+" - EC2Image: - - property: "tag:release" - value: "production" diff --git a/docs/auth.md b/docs/auth.md new file mode 100644 index 000000000..c030b9b68 --- /dev/null +++ b/docs/auth.md @@ -0,0 +1,25 @@ +# Authentication + +There are multiple ways to authenticate to AWS for *aws-nuke*. + +## Using CLI Flags + +To use *static credentials* the command line flags `--access-key-id` and `--secret-access-key` +are required. The flag `--session-token` is only required for temporary sessions. + +`--profile` is also available if you are using the [AWS Config](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) + +### AWS Config + +You can also authenticate using the [AWS Config](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) +file. This can also have static credentials in them, but you can also use profiles. These files are generally located +at `~/.aws/config` and `~/.aws/credentials`. + +To use *shared profiles* the command line flag `--profile` is required. The profile must be either defined with static +credentials in the [shared credential file](https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html) or in [shared config file](https://docs.aws.amazon.com/cli/latest/userguide/cli-roles.html) with an assuming role. + +## Environment Variables + +To use *static credentials* via environment variables, export `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and +optionally if using a temporary session `AWS_SESSION_TOKEN`. + diff --git a/docs/custom-endpoints.md b/docs/custom-endpoints.md new file mode 100644 index 000000000..c9af98b9b --- /dev/null +++ b/docs/custom-endpoints.md @@ -0,0 +1,87 @@ +# Custom Endpoints + +## Overview + +It is possible to configure aws-nuke to run against non-default AWS endpoints. It could be used for integration testing +pointing to a local endpoint such as an S3 appliance or a Stratoscale cluster for example. + +To configure aws-nuke to use custom endpoints, add the configuration directives as shown in the following example: + +## Example + +```yaml +regions: + - demo10 + +# inspired by https://www.terraform.io/docs/providers/aws/guides/custom-service-endpoints.html +endpoints: + - region: demo10 + tls_insecure_skip_verify: true + services: + - service: ec2 + url: https://10.16.145.115/api/v2/aws/ec2 + - service: s3 + url: https://10.16.145.115:1060 + - service: rds + url: https://10.16.145.115/api/v2/aws/rds + - service: elbv2 + url: https://10.16.145.115/api/v2/aws/elbv2 + - service: efs + url: https://10.16.145.115/api/v2/aws/efs + - service: emr + url: https://10.16.145.115/api/v2/aws/emr + - service: autoscaling + url: https://10.16.145.115/api/v2/aws/autoscaling + - service: cloudwatch + url: https://10.16.145.115/api/v2/aws/cloudwatch + - service: sns + url: https://10.16.145.115/api/v2/aws/sns + - service: iam + url: https://10.16.145.115/api/v2/aws/iam + - service: acm + url: https://10.16.145.115/api/v2/aws/acm + +account-blocklist: + - "account-id-of-custom-region-prod" # production + +accounts: + "account-id-of-custom-region-demo10": {} +``` + +### Output + +This can then be used as follows: + +```log +$ aws-nuke -c config/my.yaml --access-key-id --secret-access-key --default-region demo10 +aws-nuke version v2.11.0.2.gf0ad3ac.dirty - Tue Nov 26 19:15:12 IST 2019 - f0ad3aca55eb66b93b88ce2375f8ad06a7ca856f + +Do you really want to nuke the account with the ID account-id-of-custom-region-demo10 and the alias 'account-id-of-custom-region-demo10'? +Do you want to continue? Enter account alias to continue. +> account-id-of-custom-region-demo10 + +demo10 - EC2Volume - vol-099aa1bb08454fd5bc3499897f175fd8 - [tag:Name: "volume_of_5559b38e-0a56-4078-9a6f-eb446c21cadf"] - would remove +demo10 - EC2Volume - vol-11e9b09c71924354bcb4ee77e547e7db - [tag:Name: "volume_of_e4f8c806-0235-4578-8c08-dce45d4c2952"] - would remove +demo10 - EC2Volume - vol-1a10cb3f3119451997422c435abf4275 - [tag:Name: "volume-dd2e4c4a"] - would remove +demo10 - EC2Volume - vol-1a2e649df1ef449686ef8771a078bb4e - [tag:Name: "web-server-5"] - would remove +demo10 - EC2Volume - vol-481d09bbeb334ec481c12beee6f3012e - [tag:Name: "volume_of_15b606ce-9dcd-4573-b7b1-4329bc236726"] - would remove +demo10 - EC2Volume - vol-48f6bd2bebb945848b029c80b0f2de02 - [tag:Name: "Data volume for 555e9f8a"] - would remove +demo10 - EC2Volume - vol-49f0762d84f0439da805d11b6abc1fee - [tag:Name: "Data volume for acb7f3a5"] - would remove +demo10 - EC2Volume - vol-4c34656f823542b2837ac4eaff64762b - [tag:Name: "wpdb"] - would remove +demo10 - EC2Volume - vol-875f091078134fee8d1fe3b1156a4fce - [tag:Name: "volume-f1a7c95f"] - would remove +demo10 - EC2Volume - vol-8776a0d5bd4e4aefadfa8038425edb20 - [tag:Name: "web-server-6"] - would remove +demo10 - EC2Volume - vol-8ed468bfab0b42c3bc617479b8f33600 - [tag:Name: "web-server-3"] - would remove +demo10 - EC2Volume - vol-94e0370b6ab54f03822095d74b7934b2 - [tag:Name: "web-server-2"] - would remove +demo10 - EC2Volume - vol-9ece34dfa7f64dd583ab903a1273340c - [tag:Name: "volume-4ccafc2e"] - would remove +demo10 - EC2Volume - vol-a3fb3e8800c94452aff2fcec7f06c26b - [tag:Name: "web-server-0"] - would remove +demo10 - EC2Volume - vol-a53954e17cb749a283d030f26bbaf200 - [tag:Name: "volume-5484e330"] - would remove +demo10 - EC2Volume - vol-a7afe64f4d0f4965a6703cc0cfab2ba4 - [tag:Name: "Data volume for f1a7c95f"] - would remove +demo10 - EC2Volume - vol-d0bc3f2c887f4072a9fda0b8915d94c1 - [tag:Name: "physical_volume_of_39c29f53-eac4-4f02-9781-90512cc7c563"] - would remove +demo10 - EC2Volume - vol-d1f066d8dac54ae59d087d7e9947e8a9 - [tag:Name: "Data volume for 4ccafc2e"] - would remove +demo10 - EC2Volume - vol-d9adb3f084cd4d588baa08690349b1f9 - [tag:Name: "volume_of_84854c9b-98aa-4f5b-926a-38b3398c3ad2"] - would remove +demo10 - EC2Volume - vol-db42e471b19f42b7835442545214bc1a - [tag:Name: "lb-tf-lb-20191126090616258000000002"] - would remove +demo10 - EC2Volume - vol-db80932fb47243efa67c9dd34223c647 - [tag:Name: "web-server-5"] - would remove +demo10 - EC2Volume - vol-dbea1d1083654d30a43366807a125aed - [tag:Name: "volume-555e9f8a"] - would remove + +--- truncating long output --- +``` \ No newline at end of file diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 000000000..e68b3821f --- /dev/null +++ b/docs/development.md @@ -0,0 +1,19 @@ +# Development + +## Building + +The following will build the binary for the current platform and place it in the `releases` directory. + +```console +goreleaser build --clean --snapshot --single-target +``` + +## Documentation + +This is built using Material for MkDocs and can be run very easily locally providing you have docker available. + +### Running Locally + +```console +make docs-serve +``` diff --git a/docs/filtering.md b/docs/filtering.md new file mode 100644 index 000000000..29f39de94 --- /dev/null +++ b/docs/filtering.md @@ -0,0 +1,284 @@ +# Filtering + +Filtering is used to exclude or include resources from being deleted. This is important for a number of reasons to +include but limited to removing the user that runs the tool. + +## Types + +The following are comparisons that you can use to filter resources. These are used in the configuration file. + +- `exact` +- `contains` +- `glob` +- `regex` +- `dateOlderThan` + +To use a non-default comparison type, it is required to specify an object with `type` and `value` instead of the +plain string. + +These types can be used to simplify the configuration. For example, it is possible to protect all access keys of a +single user by using `glob`: + +```yaml +IAMUserAccessKey: +- type: glob + value: "admin -> *" +``` + +### Exact + +The identifier must exactly match the given string. **This is the default.** + +Exact is just that, an exact match to a resource. The following examples are identical for the `exact` filter. + +```yaml +IAMUser: +- AWSNukeUser +- type: exact + value: AWSNukeUser +``` + +### Contains + +The `contains` filter is a simple string contains match. The following examples are identical for the `contains` filter. + +```yaml +IAMUser: + - type: contains + value: Nuke +``` + +### Glob + +The identifier must match against the given [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)). This means the string might contain +wildcards like `*` and `?`. Note that globbing is designed for file paths, so the wildcards do not match the directory +separator (`/`). Details about the glob pattern can be found in the [library documentation](https://godoc.org/github.com/mb0/glob) + +```yaml +IAMUser: + - type: glob + value: "AWSNuke*" +``` + +### Regex + +The identifier must match against the given regular expression. Details about the syntax can be found +in the [library documentation](https://golang.org/pkg/regexp/syntax/). + +```yaml +IAMUser: + - type: regex + value: "AWSNuke.*" +``` + +### DateOlderThan + +The identifier is parsed as a timestamp. After the offset is added to it (specified in the `value` field), the resulting +timestamp must be AFTER the current time. Details on offset syntax can be found in the [library documentation](https://golang.org/pkg/time/#ParseDuration). +Supported date formats are epoch time: + +- `2006-01-02` +- `2006/01/02` +- `2006-01-02T15:04:05Z` +- `2006-01-02T15:04:05.999999999Z07:00` +- `2006-01-02T15:04:05Z07:00` + +## Properties + +By default, when writing a filter if you do not specify a property, it will use the `Name` property. However, resources +that do no support Properties, aws-nuke will fall back to what is called the `Legacy String`, it's essentially a +function that returns a string representation of the resource. + +Some resources support filtering via properties. When a resource support these properties, they will be listed in +the output like in this example: + +```log +global - IAMUserPolicyAttachment - 'admin -> AdministratorAccess' - [RoleName: "admin", PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess", PolicyName: "AdministratorAccess"] - would remove +``` + +To use properties, it is required to specify an object with `properties` and `value` instead of the plain string. + +These types can be used to simplify the configuration. For example, it is possible to protect all access keys +of a single user: + +```yaml +IAMUserAccessKey: + - property: UserName + value: "admin" +``` + +## Inverting + +Any filter result can be inverted by using `invert: true`, for example: + +```yaml +CloudFormationStack: + - property: Name + value: "foo" + invert: true +``` + +In this case *any* CloudFormationStack ***but*** the ones called "foo" will be filtered. Be aware that *aws-nuke* +internally takes every resource and applies every filter on it. If a filter matches, it marks the node as filtered. + +## Example + +It is also possible to use Filter Properties and Filter Types together. For example to protect all Hosted Zone of a +specific TLD: + +```yaml +Route53HostedZone: + - property: Name + type: glob + value: "*.rebuy.cloud." +``` + +## Account Level + +It is possible to filter this is important for not deleting the current user for example or for resources like S3 +Buckets which have a globally shared namespace and might be hard to recreate. Currently, the filtering is based on +the resource identifier. The identifier will be printed as the first step of *aws-nuke* (eg `i-01b489457a60298dd` +for an EC2 instance). + +!!! warning + **Even with filters you should not run aws-nuke on any AWS account, where you cannot afford to lose all resources. + It is easy to make mistakes in the filter configuration. Also, since aws-nuke is in continuous development, there is + always a possibility to introduce new bugs, no matter how careful we review new code.** + +The filters are part of the account-specific configuration and are grouped by resource types. This is an example of a +config that deletes all resources but the `admin` user with its access permissions and two access keys: + +```yaml +--- +regions: + - global + - us-east-1 + +account-blocklist: + - 1234567890 + +accounts: + 0987654321: + filters: + IAMUser: + - "admin" + IAMUserPolicyAttachment: + - "admin -> AdministratorAccess" + IAMUserAccessKey: + - "admin -> AKSDAFRETERSDF" + - "admin -> AFGDSGRTEWSFEY" +``` + +Any resource whose resource identifier exactly matches any of the filters in the list will be skipped. These will +be marked as "filtered by config" on the *aws-nuke* run. + + +## Presets + +It might be the case that some filters are the same across multiple accounts. +This especially could happen, if provisioning tools like Terraform are used or +if IAM resources follow the same pattern. + +For this case *aws-nuke* supports presets of filters, that can applied on +multiple accounts. A configuration could look like this: + +```yaml +--- +regions: + - "global" + - "eu-west-1" + +account-blocklist: + - 1234567890 + +accounts: + 555421337: + presets: + - "common" + 555133742: + presets: + - "common" + - "terraform" + 555134237: + presets: + - "common" + - "terraform" + filters: + EC2KeyPair: + - "notebook" + +presets: + terraform: + filters: + S3Bucket: + - type: glob + value: "my-statebucket-*" + DynamoDBTable: + - "terraform-lock" + common: + filters: + IAMRole: + - "OrganizationAccountAccessRole" +``` + +## Included and Excluding + +*aws-nuke* deletes a lot of resources and there might be added more at any release. Eventually, every resource should +get deleted. You might want to restrict which resources to delete. There are multiple ways to configure this. + +One way are filters, which already got mentioned. This requires to know the identifier of each resource. It is also +possible to prevent whole resource types (eg `S3Bucket`) from getting deleted with two methods. + +It is also possible to configure the resource types in the config file like in these examples: + +```yaml +regions: + - "us-east-1" + +account-blocklist: + - 1234567890 + +resource-types: + # Specifying this in the configuration will ensure that only these three + # resources are targeted by aws-nuke during it's run. + targets: + - S3Object + - S3Bucket + - IAMRole + +accounts: + 555133742: {} +``` + +```yaml +regions: + - "us-east-1" + +account-blocklist: + - 1234567890 + +resource-types: + # Specifying this in the configuration will ensure that these resources + # will be specifically excluded from aws-nuke during it's run. + excludes: + - IAMUser + +accounts: + 555133742: {} +``` + +If targets are specified in multiple places (e.g. CLI and account specific), then a resource type must be specified in +all places. In other words each configuration limits the previous ones. + +If an exclude is used, then all its resource types will not be deleted. + +**Hint:** You can see all available resource types with this command: + +```bash +aws-nuke resource-types +``` + +It is also possible to include and exclude resources using the command line arguments: + +- The `--target` flag limits nuking to the specified resource types. +- The `--exclude` flag prevent nuking of the specified resource types. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..fa4fe6939 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,27 @@ +# AWS Nuke + +Remove all resources from an AWS account. + +*aws-nuke* is stable, but it is likely that not all AWS resources are covered by it. Be encouraged to add missing +resources and create a Pull Request or to create an [Issue](https://github.com/ekristen/aws-nuke/issues/new). + +## History + +This is a full fork of the original tool written by the folks over at [rebuy-de](https://github.com/rebuy-de). This fork became necessary +after attempting to make contributions and respond to issues to learn that the current maintainers only have time to +work on the project about once a month and while receptive to bringing in other people to help maintain, made it clear +it would take time. Considering the feedback cycle was already weeks on initial communications, I had to make the hard +decision to fork and maintain it. + +Since then the rebuy-de team has taken up interest in responding to their issues and pull requests, but I have decided +to continue maintaining this fork as I have a few things I want to do with it that I don't think they will be interested. + +## libnuke + +Officially over the Christmas break of 2023, I decided to create [libnuke](https://github.com/ekristen/libnuke) which +is a library that can be used to create similar tools for other cloud providers. This library is used by both this tool, +aws-nuke, and [azure-nuke](https://github.com/ekristen/azure-nuke) and soon [gcp-nuke](https://github.com/ekristen/gcp-nuke). + +I also needed a version of this tool for Azure and GCP, and initially I just copied and altered the code I needed for +Azure, but I didn't want to have to maintain multiple copies of the same code, so I decided to create +[libnuke](https://github.com/ekristen/libnuke) to abstract all the code that was common between the two tools and write proper unit tests for it. diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 000000000..f3ee060fb --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,36 @@ +# Install + +## Install the pre-compiled binary + +### Homebrew Tap (MacOS/Linux) + +```console +brew install ekristen/tap/aws-nuke +``` + +!!! note + `brew install aws-nuke` will install the rebuy-aws version of aws-nuke, which is not the same as this version. + +## Releases + +You can download pre-compiled binaries from the [releases](https://github.com/ekristen/aws-nuke/releases) page. + +## Docker + +Registries: + +- [ghcr.io/ekristen/aws-nuke](https://github.com/ekristen/aws-nuke/pkgs/container/aws-nuke) +- [docker.io/ekristen/aws-nuke](https://hub.docker.com/r/ekristen/aws-nuke) + +You can run *aws-nuke* with Docker by using a command like this: + +## Source + +To compile *aws-nuke* from source you need a working [Golang](https://golang.org/doc/install) development environment and [goreleaser](https://goreleaser.com/install/). + +*aws-nuke* uses go modules and so the clone path should no matter. Then simply change directory into the clone and run: + +```bash +goreleaser --clean --snapshot --single-target +``` + diff --git a/docs/quick-start.md b/docs/quick-start.md new file mode 100644 index 000000000..506cc79db --- /dev/null +++ b/docs/quick-start.md @@ -0,0 +1,135 @@ +# First Run + +## First Configuration + +First you need to create a config file for *aws-nuke*. This is a minimal one: + +```yaml +regions: + - global + - us-east-1 + +account-blocklist: +- "999999999999" # production + +accounts: + "000000000000": {} # aws-nuke-example +``` + +## First Run (Dry Run) + +With this config we can run *aws-nuke*: + +```bash +$ aws-nuke nuke -c config/nuke-config.yaml +aws-nuke version v1.0.39.gc2f318f - Fri Jul 28 16:26:41 CEST 2017 - c2f318f37b7d2dec0e646da3d4d05ab5296d5bce + +Do you really want to nuke the account with the ID 000000000000 and the alias 'aws-nuke-example'? +Do you want to continue? Enter account alias to continue. +> aws-nuke-example + +us-east-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - would remove +us-east-1 - EC2Instance - 'i-01b489457a60298dd' - would remove +us-east-1 - EC2KeyPair - 'test' - would remove +us-east-1 - EC2NetworkACL - 'acl-6482a303' - cannot delete default VPC +us-east-1 - EC2RouteTable - 'rtb-ffe91e99' - would remove +us-east-1 - EC2SecurityGroup - 'sg-220e945a' - cannot delete group 'default' +us-east-1 - EC2SecurityGroup - 'sg-f20f958a' - would remove +us-east-1 - EC2Subnet - 'subnet-154d844e' - would remove +us-east-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - would remove +us-east-1 - EC2VPC - 'vpc-c6159fa1' - would remove +us-east-1 - IAMUserAccessKey - 'my-user -> ABCDEFGHIJKLMNOPQRST' - would remove +us-east-1 - IAMUserPolicyAttachment - 'my-user -> AdministratorAccess' - [UserName: "my-user", PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess", PolicyName: "AdministratorAccess"] - would remove +us-east-1 - IAMUser - 'my-user' - would remove +Scan complete: 13 total, 11 nukeable, 2 filtered. + +Would delete these resources. Provide --no-dry-run to actually destroy resources. +``` + +As we see, *aws-nuke* only lists all found resources and exits. This is because the `--no-dry-run` flag is missing. +Also, it wants to delete the administrator. We don't want to do this, because we use this user to access our account. +Therefore, we have to extend the config, so it ignores this user: + +```yaml +regions: +- us-east-1 + +account-blocklist: +- "999999999999" # production + +accounts: + "000000000000": # aws-nuke-example + filters: + IAMUser: + - "my-user" + IAMUserPolicyAttachment: + - "my-user -> AdministratorAccess" + IAMUserAccessKey: + - "my-user -> ABCDEFGHIJKLMNOPQRST" +``` + +## Second Run (No Dry Run) + +!!! warning +This will officially remove resources from your AWS account. Make sure you really want to do this! + +```bash +$ aws-nuke nuke -c config/nuke-config.yml --no-dry-run +aws-nuke version v1.0.39.gc2f318f - Fri Jul 28 16:26:41 CEST 2017 - c2f318f37b7d2dec0e646da3d4d05ab5296d5bce + +Do you really want to nuke the account with the ID 000000000000 and the alias 'aws-nuke-example'? +Do you want to continue? Enter account alias to continue. +> aws-nuke-example + +us-east-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - would remove +us-east-1 - EC2Instance - 'i-01b489457a60298dd' - would remove +us-east-1 - EC2KeyPair - 'test' - would remove +us-east-1 - EC2NetworkACL - 'acl-6482a303' - cannot delete default VPC +us-east-1 - EC2RouteTable - 'rtb-ffe91e99' - would remove +us-east-1 - EC2SecurityGroup - 'sg-220e945a' - cannot delete group 'default' +us-east-1 - EC2SecurityGroup - 'sg-f20f958a' - would remove +us-east-1 - EC2Subnet - 'subnet-154d844e' - would remove +us-east-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - would remove +us-east-1 - EC2VPC - 'vpc-c6159fa1' - would remove +us-east-1 - IAMUserAccessKey - 'my-user -> ABCDEFGHIJKLMNOPQRST' - filtered by config +us-east-1 - IAMUserPolicyAttachment - 'my-user -> AdministratorAccess' - [UserName: "my-user", PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess", PolicyName: "AdministratorAccess"] - would remove +us-east-1 - IAMUser - 'my-user' - filtered by config +Scan complete: 13 total, 8 nukeable, 5 filtered. + +Do you really want to nuke these resources on the account with the ID 000000000000 and the alias 'aws-nuke-example'? +Do you want to continue? Enter account alias to continue. +> aws-nuke-example + +us-east-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - failed +us-east-1 - EC2Instance - 'i-01b489457a60298dd' - triggered remove +us-east-1 - EC2KeyPair - 'test' - triggered remove +us-east-1 - EC2RouteTable - 'rtb-ffe91e99' - failed +us-east-1 - EC2SecurityGroup - 'sg-f20f958a' - failed +us-east-1 - EC2Subnet - 'subnet-154d844e' - failed +us-east-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - failed +us-east-1 - EC2VPC - 'vpc-c6159fa1' - failed +us-east-1 - S3Object - 's3://rebuy-terraform-state-138758637120/run-terraform.lock' - triggered remove + +Removal requested: 2 waiting, 6 failed, 5 skipped, 0 finished + +us-east-1 - EC2DHCPOption - 'dopt-bf2ec3d8' - failed +us-east-1 - EC2Instance - 'i-01b489457a60298dd' - waiting +us-east-1 - EC2KeyPair - 'test' - removed +us-east-1 - EC2RouteTable - 'rtb-ffe91e99' - failed +us-east-1 - EC2SecurityGroup - 'sg-f20f958a' - failed +us-east-1 - EC2Subnet - 'subnet-154d844e' - failed +us-east-1 - EC2Volume - 'vol-0ddfb15461a00c3e2' - failed +us-east-1 - EC2VPC - 'vpc-c6159fa1' - failed + +Removal requested: 1 waiting, 6 failed, 5 skipped, 1 finished + +--- truncating long output --- +``` + +As you see *aws-nuke* now tries to delete all resources which aren't filtered, without caring about the dependencies +between them. This results in API errors which can be ignored. These errors are shown at the end of the *aws-nuke* run, +if they keep to appear. + +*aws-nuke* retries deleting all resources until all specified ones are deleted +or until there are only resources with errors left. + diff --git a/docs/releases.md b/docs/releases.md new file mode 100644 index 000000000..6cf041d5d --- /dev/null +++ b/docs/releases.md @@ -0,0 +1,8 @@ +# Releases + +We usually release a new version once enough changes came together and have been tested for a while. + +You can find Linux, macOS and Windows binaries on the [releases page](https://github.com/ekristen/aws-nuke/releases), but we also provide containerized +versions on [ghcr.io/ekristen/aws-nuke](https://ghcr.io/ekristen/aws-nuke) and [docker.io/ekristen/aws-nuke](https://hub.docker.com/r/ekristen/aws-nuke). Both are available for multiple +architectures (amd64, arm64 & armv7) using Docker manifests. You can reference the main tag on any system and get +the correct docker image automatically. \ No newline at end of file diff --git a/docs/resources.md b/docs/resources.md new file mode 100644 index 000000000..180493145 --- /dev/null +++ b/docs/resources.md @@ -0,0 +1,104 @@ +# Resources + +Resources are the core of the tool, they are what is used to list and remove resources from AWS. The resources are +broken down into separate files. + +When creating a resource there's the base resource type, then there's the `Lister` type that returns a list of resources +that it discovers. Those resources are then filtered by any filtering criteria on the resource itself. + +## Anatomy of a Resource + +The anatomy of a resource is fairly simple, it's broken down into a few parts: + +- `Resource` - This is the base resource type that is used to define the resource. +- `Lister` - This is the type that is used to list the resources. + +The resource must have the `func Remove() error` method defined on it, this is what is used to remove the resource. + +It can optionally have the following methods defined: + +- `func Filter() error` - This is used to pre-filter resources, usually based on internal criteria, like system defaults. +- `func String() string` - This is used to print the resource in a human-readable format. +- `func Properties() types.Properties` - This is used to print the resource in a human-readable format. + +### Example + +```go +package resources + +import ( + "context" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +type ExampleResourceLister struct{} + +func (l *ExampleResourceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + var resources []resource.Resource + + // list the resources and add to resources slice + + return resources, nil +} + +// ----------------------------------------------------------------------------- + +type ExampleResource struct { + ID *string +} + +func (r *ExampleResource) Remove(_ context.Context) error { + // remove the resource, an error will put the resource in failed state + // resources in failed state are retried a number of times + return nil +} + +func (r *ExampleResource) Filter() error { + // filter the resource, this is useful for built-in resources that cannot + // be removed, like an AWS managed resource, return an error here to filter + // it before it even gets to the user supplied filters. + return nil +} + +func (r *ExampleResource) String() string { + // return a string representation of the resource, this is legacy, but still + // used for a number of reasons. + return *r.ID +} + +func (r *ExampleResource) Properties() types.Properties { + // return a properties representation of the resource + props := types.NewProperties() + props.Set("ID", r.ID) + return props +} +``` + +## Creating a new resource + +Creating a new resources is fairly straightforward and a template is provided for you, along with a tool to help you +generate the boilerplate code. + +Currently, the code is generated using a tool that is located in `tools/create-resource/main.go` and can be run like so: + +!!! note + At present, the tool does not check if the service or the resource type is valid, this is purely a helper tool to + generate the boilerplate code. + +```bash +go run tools/create-resource/main.go +``` + +This will output the boilerplate code to stdout, so you can copy and paste it into the appropriate file or you can +redirect to a file like so: + +```bash +go run tools/create-resource/main.go > resources/.go +``` + diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 000000000..31d148ba5 --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,20 @@ +# Testing + +This is not a lot of test coverage around the resources themselves. This is due to the cost + +## Unit Tests + +To unit test *aws-nuke*, some tests require [gomock](https://github.com/golang/mock) to run. However these mocks are +included in the source code already, but they can be generated by running: + +```bash +make generate +``` + +Which is just a wrapper around `go generate ./...`. + +To run the unit tests, simply run: + +```bash +make test +``` \ No newline at end of file diff --git a/docs/warning.md b/docs/warning.md new file mode 100644 index 000000000..be809df6c --- /dev/null +++ b/docs/warning.md @@ -0,0 +1,31 @@ +# Caution and Warning + +!!! danger + Be aware that *aws-nuke* is a very destructive tool, hence you have to be very careful while using it. Otherwise, + you might delete production data. + +!!! warning + **We strongly advise you to not run this application on any AWS account, where you cannot afford to lose + all resources.** + +To reduce the blast radius of accidents, there are some safety precautions: + +1. By default, *aws-nuke* only lists all nuke-able resources. You need to add `--no-dry-run` to actually delete + resources. +2. *aws-nuke* asks you twice to confirm the deletion by entering the account alias. The first time is directly + after the start and the second time after listing all nuke-able resources. +3. To avoid just displaying a account ID, which might gladly be ignored by humans, it is required to actually set + an [Account Alias](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html) for your account. Otherwise, *aws-nuke* will abort. +4. The Account Alias must not contain the string `prod`. This string is hardcoded, and it is recommended to add it + to every actual production account (e.g. `mycompany-production-ecr`). +5. The config file contains a blocklist field. If the Account ID of the account you want to nuke is part of this + blocklist, *aws-nuke* will abort. It is recommended, that you add every production account to this blocklist. +6. To ensure you don't just ignore the blocklisting feature, the blocklist must contain at least one Account ID. +7. The config file contains account specific settings (e.g. filters). The account you want to nuke must be explicitly + listed there. +8. To ensure to not accidentally delete a random account, it is required to specify a config file. It is recommended + to have only a single config file and add it to a central repository. This way the account blocklist is way + easier to manage and keep up to date. + +Feel free to create an issue, if you have any ideas to improve the safety procedures. + diff --git a/go.mod b/go.mod index 20c924e26..bf5a1cccc 100644 --- a/go.mod +++ b/go.mod @@ -1,44 +1,35 @@ -module github.com/rebuy-de/aws-nuke/v2 +module github.com/ekristen/aws-nuke -go 1.19 +go 1.21.6 require ( - github.com/Masterminds/sprig v2.22.0+incompatible - github.com/aws/aws-sdk-go v1.44.225 - github.com/aws/smithy-go v1.13.5 - github.com/fatih/color v1.15.0 + github.com/aws/aws-sdk-go v1.49.13 + github.com/ekristen/libnuke v0.0.0-20240115160410-493db5654770 + github.com/fatih/color v1.16.0 github.com/golang/mock v1.6.0 - github.com/google/uuid v1.3.0 - github.com/iancoleman/strcase v0.2.0 - github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 + github.com/google/uuid v1.5.0 + github.com/gotidy/ptr v1.4.0 github.com/pkg/errors v0.9.1 - github.com/rebuy-de/rebuy-go-sdk/v4 v4.5.1 - github.com/sirupsen/logrus v1.9.0 - github.com/spf13/cobra v1.6.1 - github.com/stretchr/testify v1.8.1 - golang.org/x/sync v0.1.0 + github.com/sirupsen/logrus v1.9.3 + github.com/stretchr/testify v1.8.4 + github.com/urfave/cli/v2 v2.27.1 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver v1.5.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gemnasium/logrus-graylog-hook/v3 v3.1.0 // indirect - github.com/huandu/xstrings v1.4.0 // indirect - github.com/imdario/mergo v0.3.14 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect - github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 // indirect + github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/mod v0.9.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/tools v0.7.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/stevenle/topsort v0.2.0 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/go.sum b/go.sum index c9f60316c..48a298ed2 100644 --- a/go.sum +++ b/go.sum @@ -1,43 +1,28 @@ -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/aws/aws-sdk-go v1.44.225 h1:JNJpUg+M1cm4jtKnyex//Mw1Rv8QN/kWT3dtr+oLdW4= -github.com/aws/aws-sdk-go v1.44.225/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= -github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= -github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/aws-sdk-go v1.49.13 h1:f4mGztsgnx2dR9r8FQYa9YW/RsKb+N7bgef4UGrOW1Y= +github.com/aws/aws-sdk-go v1.49.13/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/gemnasium/logrus-graylog-hook/v3 v3.1.0 h1:SLtCnpI5ZZaz4l7RSatEhppB1BBhUEu+DqGANJzJdEA= -github.com/gemnasium/logrus-graylog-hook/v3 v3.1.0/go.mod h1:wi1zWv9tIvyLSMLCAzgRP+YR24oLVQVBHfPPKjtht44= +github.com/ekristen/libnuke v0.0.0-20240115160410-493db5654770 h1:RE8cbaqUhdxOAguCqz0poOOL48vTUWLTBmSDUy5STGc= +github.com/ekristen/libnuke v0.0.0-20240115160410-493db5654770/go.mod h1:1ySAhDQd6laQdG7VbG/+i+DAFIVMHlrk2ZXgwHuvOk4= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= -github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/imdario/mergo v0.3.14 h1:fOqeC1+nCuuk6PKQdg9YmosXX7Y7mHX6R/0ZldI9iHo= -github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gotidy/ptr v1.4.0 h1:7++suUs+HNHMnyz6/AW3SE+4EnBhupPSQTSI7QNijVc= +github.com/gotidy/ptr v1.4.0/go.mod h1:MjRBG6/IETiiZGWI8LrRtISXEji+8b/jigmj2q0mEyM= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -45,91 +30,64 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 h1:NK3O7S5FRD/wj7ORQ5C3Mx1STpyEMuFe+/F0Lakd1Nk= github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4/go.mod h1:FqD3ES5hx6zpzDainDaHgkTIqrPaI9uX4CVWqYZoQjY= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= +github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rebuy-de/rebuy-go-sdk/v4 v4.5.1 h1:7QWjC0uku9pIqTXS664clCMjqhZLjO/sUV7yTJJwzAk= -github.com/rebuy-de/rebuy-go-sdk/v4 v4.5.1/go.mod h1:ZSfnIcE8RFKz7IO6AFZjETDbPyMdUjtxCea9R7Q6pQE= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stevenle/topsort v0.2.0 h1:LLWgtp34HPX6/RBDRS0kElVxGOTzGBLI1lSAa5Lb46k= +github.com/stevenle/topsort v0.2.0/go.mod h1:ck2WG2/ZrOr6dLApQ/5Xrqy5wv3T0qhKYWE7r9tkibc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= +github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -138,6 +96,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/golang.mk b/golang.mk deleted file mode 100644 index 4b77cafc3..000000000 --- a/golang.mk +++ /dev/null @@ -1,92 +0,0 @@ -TARGETS?="." -PACKAGE=$(shell GOPATH= go list $(TARGET)) -NAME=$(notdir $(shell echo $(PACKAGE) | sed 's/\/v2//')) - -BUILD_VERSION=$(shell git describe --always --dirty --tags | tr '-' '.' ) -BUILD_DATE=$(shell LC_ALL=C date) -BUILD_HASH=$(shell git rev-parse HEAD) -BUILD_MACHINE=$(shell uname -n) -BUILD_USER=$(shell whoami) -BUILD_ENVIRONMENT=$(BUILD_USER)@$(BUILD_MACHINE) - -BUILD_XDST=$(PACKAGE)/cmd -BUILD_FLAGS=-ldflags "\ - $(ADDITIONAL_LDFLAGS) -s -w \ - -X '$(BUILD_XDST).BuildVersion=$(BUILD_VERSION)' \ - -X '$(BUILD_XDST).BuildDate=$(BUILD_DATE)' \ - -X '$(BUILD_XDST).BuildHash=$(BUILD_HASH)' \ - -X '$(BUILD_XDST).BuildEnvironment=$(BUILD_ENVIRONMENT)' \ -" - -GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*") -GOPKGS=$(shell go list ./...) - -OUTPUT_FILE=$(NAME)-$(BUILD_VERSION)-$(shell go env GOOS)-$(shell go env GOARCH)$(shell go env GOARM)$(shell go env GOEXE) -OUTPUT_LINK=$(NAME)$(shell go env GOEXE) -WINDOWS_ZIP=$(shell echo $(OUTPUT_FILE) | sed 's/\.exe/\.zip/') - -default: build - -vendor: go.mod go.sum - go mod vendor - touch vendor - -format: - gofmt -s -w $(GOFILES) - -vet: go_generate vendor - go vet $(GOPKGS) - -lint: - $(foreach pkg,$(GOPKGS),golint $(pkg);) - -go_generate: - rm -rvf mocks - go generate ./... - -test_packages: go_generate vendor - go test $(GOPKGS) - -test_format: - gofmt -s -l $(GOFILES) - -test: test_format vet lint test_packages - -cov: go_generate - gocov test -v $(GOPKGS) \ - | gocov-html > coverage.html - -_build: vendor - mkdir -p dist - $(foreach TARGET,$(TARGETS),go build \ - $(BUILD_FLAGS) \ - -o dist/$(OUTPUT_FILE) \ - $(TARGET);\ - ) - -build: go_generate _build - $(foreach TARGET,$(TARGETS),ln -sf $(OUTPUT_FILE) dist/$(OUTPUT_LINK);) - -compress: _build -ifeq ($(GOOS),windows) - zip -j dist/$(WINDOWS_ZIP) dist/$(OUTPUT_FILE) -else - tar czf dist/$(OUTPUT_FILE).tar.gz -C dist $(OUTPUT_FILE) -endif - rm -f dist/$(OUTPUT_FILE) - -xc: go_generate - GOOS=linux GOARCH=amd64 make compress - GOOS=linux GOARCH=arm64 make compress - GOOS=linux GOARCH=arm GOARM=7 make compress - GOOS=darwin GOARCH=amd64 make compress - GOOS=darwin GOARCH=arm64 make compress - GOOS=windows GOARCH=amd64 make compress - -install: test - $(foreach TARGET,$(TARGETS),go install \ - $(BUILD_FLAGS);) - -clean: - rm dist/ -rvf - rm mocks/ -rvf diff --git a/main.go b/main.go index d6379f0a5..0c9640144 100644 --- a/main.go +++ b/main.go @@ -1,13 +1,46 @@ package main import ( + "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" "os" - "github.com/rebuy-de/aws-nuke/v2/cmd" + "github.com/ekristen/aws-nuke/pkg/common" + + _ "github.com/ekristen/aws-nuke/pkg/commands/list" + _ "github.com/ekristen/aws-nuke/pkg/commands/nuke" + + _ "github.com/ekristen/aws-nuke/resources" ) func main() { - if err := cmd.NewRootCommand().Execute(); err != nil { - os.Exit(-1) + defer func() { + if r := recover(); r != nil { + // log panics forces exit + if _, ok := r.(*logrus.Entry); ok { + os.Exit(1) + } + panic(r) + } + }() + + app := cli.NewApp() + app.Name = common.AppVersion.Name + app.Usage = "remove everything from an aws account" + app.Version = common.AppVersion.Summary + app.Authors = []*cli.Author{ + { + Name: "Erik Kristensen", + Email: "erik@erikkristensen.com", + }, + } + + app.Commands = common.GetCommands() + app.CommandNotFound = func(context *cli.Context, command string) { + logrus.Fatalf("Command %s not found.", command) + } + + if err := app.Run(os.Args); err != nil { + logrus.Fatal(err) } } diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 000000000..50ab06dbc --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,68 @@ +site_name: AWS Nuke +site_url: https://ekristen.github.io/aws-nuke +repo_name: ekristen/aws-nuke +repo_url: https://github.com/ekristen/aws-nuke +edit_uri: "" + +site_dir: public + +# Configuration +theme: + name: material + language: en + palette: + - media: "(prefers-color-scheme)" + toggle: + icon: material/link + name: Switch to light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: indigo + accent: indigo + toggle: + icon: material/toggle-switch + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: black + accent: indigo + toggle: + icon: material/toggle-switch-off + name: Switch to system preference + features: + - navigation.sections + #- navigation.tabs + - toc.integrate + - navigation.path + +# Plugins +plugins: + - search + +# Extensions +markdown_extensions: + - admonition + - pymdownx.highlight + - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true + - toc: + permalink: true + +# Page tree +nav: + - Getting Started: + - Introduction: index.md + - Warning: warning.md + - Install: installation.md + - Authentication: auth.md + - Quick Start: quick-start.md + - Config: + - Filtering: filtering.md + - Custom Endpoints: custom-endpoints.md + - Development: + - Overview: development.md + - Resources: resources.md + - Releases: releases.md + - Testing: testing.md + diff --git a/mocks/mock_cloudformationiface/mock.go b/mocks/mock_cloudformationiface/mock.go new file mode 100644 index 000000000..24e253fd8 --- /dev/null +++ b/mocks/mock_cloudformationiface/mock.go @@ -0,0 +1,4189 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: /Users/ekristen/go/pkg/mod/github.com/aws/aws-sdk-go@v1.44.225/service/cloudformation/cloudformationiface/interface.go + +// Package mock_cloudformationiface is a generated GoMock package. +package mock_cloudformationiface + +import ( + reflect "reflect" + + aws "github.com/aws/aws-sdk-go/aws" + request "github.com/aws/aws-sdk-go/aws/request" + cloudformation "github.com/aws/aws-sdk-go/service/cloudformation" + gomock "github.com/golang/mock/gomock" +) + +// MockCloudFormationAPI is a mock of CloudFormationAPI interface. +type MockCloudFormationAPI struct { + ctrl *gomock.Controller + recorder *MockCloudFormationAPIMockRecorder +} + +func (m *MockCloudFormationAPI) ActivateOrganizationsAccess(input *cloudformation.ActivateOrganizationsAccessInput) (*cloudformation.ActivateOrganizationsAccessOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) ActivateOrganizationsAccessWithContext(context aws.Context, input *cloudformation.ActivateOrganizationsAccessInput, option ...request.Option) (*cloudformation.ActivateOrganizationsAccessOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) ActivateOrganizationsAccessRequest(input *cloudformation.ActivateOrganizationsAccessInput) (*request.Request, *cloudformation.ActivateOrganizationsAccessOutput) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) DeactivateOrganizationsAccess(input *cloudformation.DeactivateOrganizationsAccessInput) (*cloudformation.DeactivateOrganizationsAccessOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) DeactivateOrganizationsAccessWithContext(context aws.Context, input *cloudformation.DeactivateOrganizationsAccessInput, option ...request.Option) (*cloudformation.DeactivateOrganizationsAccessOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) DeactivateOrganizationsAccessRequest(input *cloudformation.DeactivateOrganizationsAccessInput) (*request.Request, *cloudformation.DeactivateOrganizationsAccessOutput) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) DescribeOrganizationsAccess(input *cloudformation.DescribeOrganizationsAccessInput) (*cloudformation.DescribeOrganizationsAccessOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) DescribeOrganizationsAccessWithContext(context aws.Context, input *cloudformation.DescribeOrganizationsAccessInput, option ...request.Option) (*cloudformation.DescribeOrganizationsAccessOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) DescribeOrganizationsAccessRequest(input *cloudformation.DescribeOrganizationsAccessInput) (*request.Request, *cloudformation.DescribeOrganizationsAccessOutput) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) ListStackInstanceResourceDrifts(input *cloudformation.ListStackInstanceResourceDriftsInput) (*cloudformation.ListStackInstanceResourceDriftsOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) ListStackInstanceResourceDriftsWithContext(context aws.Context, input *cloudformation.ListStackInstanceResourceDriftsInput, option ...request.Option) (*cloudformation.ListStackInstanceResourceDriftsOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockCloudFormationAPI) ListStackInstanceResourceDriftsRequest(input *cloudformation.ListStackInstanceResourceDriftsInput) (*request.Request, *cloudformation.ListStackInstanceResourceDriftsOutput) { + //TODO implement me + panic("implement me") +} + +// MockCloudFormationAPIMockRecorder is the mock recorder for MockCloudFormationAPI. +type MockCloudFormationAPIMockRecorder struct { + mock *MockCloudFormationAPI +} + +// NewMockCloudFormationAPI creates a new mock instance. +func NewMockCloudFormationAPI(ctrl *gomock.Controller) *MockCloudFormationAPI { + mock := &MockCloudFormationAPI{ctrl: ctrl} + mock.recorder = &MockCloudFormationAPIMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockCloudFormationAPI) EXPECT() *MockCloudFormationAPIMockRecorder { + return m.recorder +} + +// ActivateType mocks base method. +func (m *MockCloudFormationAPI) ActivateType(arg0 *cloudformation.ActivateTypeInput) (*cloudformation.ActivateTypeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ActivateType", arg0) + ret0, _ := ret[0].(*cloudformation.ActivateTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ActivateType indicates an expected call of ActivateType. +func (mr *MockCloudFormationAPIMockRecorder) ActivateType(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActivateType", reflect.TypeOf((*MockCloudFormationAPI)(nil).ActivateType), arg0) +} + +// ActivateTypeRequest mocks base method. +func (m *MockCloudFormationAPI) ActivateTypeRequest(arg0 *cloudformation.ActivateTypeInput) (*request.Request, *cloudformation.ActivateTypeOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ActivateTypeRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ActivateTypeOutput) + return ret0, ret1 +} + +// ActivateTypeRequest indicates an expected call of ActivateTypeRequest. +func (mr *MockCloudFormationAPIMockRecorder) ActivateTypeRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActivateTypeRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ActivateTypeRequest), arg0) +} + +// ActivateTypeWithContext mocks base method. +func (m *MockCloudFormationAPI) ActivateTypeWithContext(arg0 aws.Context, arg1 *cloudformation.ActivateTypeInput, arg2 ...request.Option) (*cloudformation.ActivateTypeOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ActivateTypeWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ActivateTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ActivateTypeWithContext indicates an expected call of ActivateTypeWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ActivateTypeWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActivateTypeWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ActivateTypeWithContext), varargs...) +} + +// BatchDescribeTypeConfigurations mocks base method. +func (m *MockCloudFormationAPI) BatchDescribeTypeConfigurations(arg0 *cloudformation.BatchDescribeTypeConfigurationsInput) (*cloudformation.BatchDescribeTypeConfigurationsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BatchDescribeTypeConfigurations", arg0) + ret0, _ := ret[0].(*cloudformation.BatchDescribeTypeConfigurationsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BatchDescribeTypeConfigurations indicates an expected call of BatchDescribeTypeConfigurations. +func (mr *MockCloudFormationAPIMockRecorder) BatchDescribeTypeConfigurations(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchDescribeTypeConfigurations", reflect.TypeOf((*MockCloudFormationAPI)(nil).BatchDescribeTypeConfigurations), arg0) +} + +// BatchDescribeTypeConfigurationsRequest mocks base method. +func (m *MockCloudFormationAPI) BatchDescribeTypeConfigurationsRequest(arg0 *cloudformation.BatchDescribeTypeConfigurationsInput) (*request.Request, *cloudformation.BatchDescribeTypeConfigurationsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BatchDescribeTypeConfigurationsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.BatchDescribeTypeConfigurationsOutput) + return ret0, ret1 +} + +// BatchDescribeTypeConfigurationsRequest indicates an expected call of BatchDescribeTypeConfigurationsRequest. +func (mr *MockCloudFormationAPIMockRecorder) BatchDescribeTypeConfigurationsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchDescribeTypeConfigurationsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).BatchDescribeTypeConfigurationsRequest), arg0) +} + +// BatchDescribeTypeConfigurationsWithContext mocks base method. +func (m *MockCloudFormationAPI) BatchDescribeTypeConfigurationsWithContext(arg0 aws.Context, arg1 *cloudformation.BatchDescribeTypeConfigurationsInput, arg2 ...request.Option) (*cloudformation.BatchDescribeTypeConfigurationsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "BatchDescribeTypeConfigurationsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.BatchDescribeTypeConfigurationsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BatchDescribeTypeConfigurationsWithContext indicates an expected call of BatchDescribeTypeConfigurationsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) BatchDescribeTypeConfigurationsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BatchDescribeTypeConfigurationsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).BatchDescribeTypeConfigurationsWithContext), varargs...) +} + +// CancelUpdateStack mocks base method. +func (m *MockCloudFormationAPI) CancelUpdateStack(arg0 *cloudformation.CancelUpdateStackInput) (*cloudformation.CancelUpdateStackOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CancelUpdateStack", arg0) + ret0, _ := ret[0].(*cloudformation.CancelUpdateStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CancelUpdateStack indicates an expected call of CancelUpdateStack. +func (mr *MockCloudFormationAPIMockRecorder) CancelUpdateStack(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelUpdateStack", reflect.TypeOf((*MockCloudFormationAPI)(nil).CancelUpdateStack), arg0) +} + +// CancelUpdateStackRequest mocks base method. +func (m *MockCloudFormationAPI) CancelUpdateStackRequest(arg0 *cloudformation.CancelUpdateStackInput) (*request.Request, *cloudformation.CancelUpdateStackOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CancelUpdateStackRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.CancelUpdateStackOutput) + return ret0, ret1 +} + +// CancelUpdateStackRequest indicates an expected call of CancelUpdateStackRequest. +func (mr *MockCloudFormationAPIMockRecorder) CancelUpdateStackRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelUpdateStackRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).CancelUpdateStackRequest), arg0) +} + +// CancelUpdateStackWithContext mocks base method. +func (m *MockCloudFormationAPI) CancelUpdateStackWithContext(arg0 aws.Context, arg1 *cloudformation.CancelUpdateStackInput, arg2 ...request.Option) (*cloudformation.CancelUpdateStackOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CancelUpdateStackWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.CancelUpdateStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CancelUpdateStackWithContext indicates an expected call of CancelUpdateStackWithContext. +func (mr *MockCloudFormationAPIMockRecorder) CancelUpdateStackWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelUpdateStackWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).CancelUpdateStackWithContext), varargs...) +} + +// ContinueUpdateRollback mocks base method. +func (m *MockCloudFormationAPI) ContinueUpdateRollback(arg0 *cloudformation.ContinueUpdateRollbackInput) (*cloudformation.ContinueUpdateRollbackOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContinueUpdateRollback", arg0) + ret0, _ := ret[0].(*cloudformation.ContinueUpdateRollbackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContinueUpdateRollback indicates an expected call of ContinueUpdateRollback. +func (mr *MockCloudFormationAPIMockRecorder) ContinueUpdateRollback(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContinueUpdateRollback", reflect.TypeOf((*MockCloudFormationAPI)(nil).ContinueUpdateRollback), arg0) +} + +// ContinueUpdateRollbackRequest mocks base method. +func (m *MockCloudFormationAPI) ContinueUpdateRollbackRequest(arg0 *cloudformation.ContinueUpdateRollbackInput) (*request.Request, *cloudformation.ContinueUpdateRollbackOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContinueUpdateRollbackRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ContinueUpdateRollbackOutput) + return ret0, ret1 +} + +// ContinueUpdateRollbackRequest indicates an expected call of ContinueUpdateRollbackRequest. +func (mr *MockCloudFormationAPIMockRecorder) ContinueUpdateRollbackRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContinueUpdateRollbackRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ContinueUpdateRollbackRequest), arg0) +} + +// ContinueUpdateRollbackWithContext mocks base method. +func (m *MockCloudFormationAPI) ContinueUpdateRollbackWithContext(arg0 aws.Context, arg1 *cloudformation.ContinueUpdateRollbackInput, arg2 ...request.Option) (*cloudformation.ContinueUpdateRollbackOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ContinueUpdateRollbackWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ContinueUpdateRollbackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContinueUpdateRollbackWithContext indicates an expected call of ContinueUpdateRollbackWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ContinueUpdateRollbackWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContinueUpdateRollbackWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ContinueUpdateRollbackWithContext), varargs...) +} + +// CreateChangeSet mocks base method. +func (m *MockCloudFormationAPI) CreateChangeSet(arg0 *cloudformation.CreateChangeSetInput) (*cloudformation.CreateChangeSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateChangeSet", arg0) + ret0, _ := ret[0].(*cloudformation.CreateChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateChangeSet indicates an expected call of CreateChangeSet. +func (mr *MockCloudFormationAPIMockRecorder) CreateChangeSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateChangeSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateChangeSet), arg0) +} + +// CreateChangeSetRequest mocks base method. +func (m *MockCloudFormationAPI) CreateChangeSetRequest(arg0 *cloudformation.CreateChangeSetInput) (*request.Request, *cloudformation.CreateChangeSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateChangeSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.CreateChangeSetOutput) + return ret0, ret1 +} + +// CreateChangeSetRequest indicates an expected call of CreateChangeSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) CreateChangeSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateChangeSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateChangeSetRequest), arg0) +} + +// CreateChangeSetWithContext mocks base method. +func (m *MockCloudFormationAPI) CreateChangeSetWithContext(arg0 aws.Context, arg1 *cloudformation.CreateChangeSetInput, arg2 ...request.Option) (*cloudformation.CreateChangeSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateChangeSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.CreateChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateChangeSetWithContext indicates an expected call of CreateChangeSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) CreateChangeSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateChangeSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateChangeSetWithContext), varargs...) +} + +// CreateStack mocks base method. +func (m *MockCloudFormationAPI) CreateStack(arg0 *cloudformation.CreateStackInput) (*cloudformation.CreateStackOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateStack", arg0) + ret0, _ := ret[0].(*cloudformation.CreateStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateStack indicates an expected call of CreateStack. +func (mr *MockCloudFormationAPIMockRecorder) CreateStack(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStack", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStack), arg0) +} + +// CreateStackInstances mocks base method. +func (m *MockCloudFormationAPI) CreateStackInstances(arg0 *cloudformation.CreateStackInstancesInput) (*cloudformation.CreateStackInstancesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateStackInstances", arg0) + ret0, _ := ret[0].(*cloudformation.CreateStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateStackInstances indicates an expected call of CreateStackInstances. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackInstances(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackInstances", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackInstances), arg0) +} + +// CreateStackInstancesRequest mocks base method. +func (m *MockCloudFormationAPI) CreateStackInstancesRequest(arg0 *cloudformation.CreateStackInstancesInput) (*request.Request, *cloudformation.CreateStackInstancesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateStackInstancesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.CreateStackInstancesOutput) + return ret0, ret1 +} + +// CreateStackInstancesRequest indicates an expected call of CreateStackInstancesRequest. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackInstancesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackInstancesRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackInstancesRequest), arg0) +} + +// CreateStackInstancesWithContext mocks base method. +func (m *MockCloudFormationAPI) CreateStackInstancesWithContext(arg0 aws.Context, arg1 *cloudformation.CreateStackInstancesInput, arg2 ...request.Option) (*cloudformation.CreateStackInstancesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateStackInstancesWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.CreateStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateStackInstancesWithContext indicates an expected call of CreateStackInstancesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackInstancesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackInstancesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackInstancesWithContext), varargs...) +} + +// CreateStackRequest mocks base method. +func (m *MockCloudFormationAPI) CreateStackRequest(arg0 *cloudformation.CreateStackInput) (*request.Request, *cloudformation.CreateStackOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateStackRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.CreateStackOutput) + return ret0, ret1 +} + +// CreateStackRequest indicates an expected call of CreateStackRequest. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackRequest), arg0) +} + +// CreateStackSet mocks base method. +func (m *MockCloudFormationAPI) CreateStackSet(arg0 *cloudformation.CreateStackSetInput) (*cloudformation.CreateStackSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateStackSet", arg0) + ret0, _ := ret[0].(*cloudformation.CreateStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateStackSet indicates an expected call of CreateStackSet. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackSet), arg0) +} + +// CreateStackSetRequest mocks base method. +func (m *MockCloudFormationAPI) CreateStackSetRequest(arg0 *cloudformation.CreateStackSetInput) (*request.Request, *cloudformation.CreateStackSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateStackSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.CreateStackSetOutput) + return ret0, ret1 +} + +// CreateStackSetRequest indicates an expected call of CreateStackSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackSetRequest), arg0) +} + +// CreateStackSetWithContext mocks base method. +func (m *MockCloudFormationAPI) CreateStackSetWithContext(arg0 aws.Context, arg1 *cloudformation.CreateStackSetInput, arg2 ...request.Option) (*cloudformation.CreateStackSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateStackSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.CreateStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateStackSetWithContext indicates an expected call of CreateStackSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackSetWithContext), varargs...) +} + +// CreateStackWithContext mocks base method. +func (m *MockCloudFormationAPI) CreateStackWithContext(arg0 aws.Context, arg1 *cloudformation.CreateStackInput, arg2 ...request.Option) (*cloudformation.CreateStackOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateStackWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.CreateStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateStackWithContext indicates an expected call of CreateStackWithContext. +func (mr *MockCloudFormationAPIMockRecorder) CreateStackWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStackWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).CreateStackWithContext), varargs...) +} + +// DeactivateType mocks base method. +func (m *MockCloudFormationAPI) DeactivateType(arg0 *cloudformation.DeactivateTypeInput) (*cloudformation.DeactivateTypeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeactivateType", arg0) + ret0, _ := ret[0].(*cloudformation.DeactivateTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeactivateType indicates an expected call of DeactivateType. +func (mr *MockCloudFormationAPIMockRecorder) DeactivateType(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeactivateType", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeactivateType), arg0) +} + +// DeactivateTypeRequest mocks base method. +func (m *MockCloudFormationAPI) DeactivateTypeRequest(arg0 *cloudformation.DeactivateTypeInput) (*request.Request, *cloudformation.DeactivateTypeOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeactivateTypeRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DeactivateTypeOutput) + return ret0, ret1 +} + +// DeactivateTypeRequest indicates an expected call of DeactivateTypeRequest. +func (mr *MockCloudFormationAPIMockRecorder) DeactivateTypeRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeactivateTypeRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeactivateTypeRequest), arg0) +} + +// DeactivateTypeWithContext mocks base method. +func (m *MockCloudFormationAPI) DeactivateTypeWithContext(arg0 aws.Context, arg1 *cloudformation.DeactivateTypeInput, arg2 ...request.Option) (*cloudformation.DeactivateTypeOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeactivateTypeWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DeactivateTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeactivateTypeWithContext indicates an expected call of DeactivateTypeWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DeactivateTypeWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeactivateTypeWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeactivateTypeWithContext), varargs...) +} + +// DeleteChangeSet mocks base method. +func (m *MockCloudFormationAPI) DeleteChangeSet(arg0 *cloudformation.DeleteChangeSetInput) (*cloudformation.DeleteChangeSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteChangeSet", arg0) + ret0, _ := ret[0].(*cloudformation.DeleteChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteChangeSet indicates an expected call of DeleteChangeSet. +func (mr *MockCloudFormationAPIMockRecorder) DeleteChangeSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteChangeSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteChangeSet), arg0) +} + +// DeleteChangeSetRequest mocks base method. +func (m *MockCloudFormationAPI) DeleteChangeSetRequest(arg0 *cloudformation.DeleteChangeSetInput) (*request.Request, *cloudformation.DeleteChangeSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteChangeSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DeleteChangeSetOutput) + return ret0, ret1 +} + +// DeleteChangeSetRequest indicates an expected call of DeleteChangeSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) DeleteChangeSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteChangeSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteChangeSetRequest), arg0) +} + +// DeleteChangeSetWithContext mocks base method. +func (m *MockCloudFormationAPI) DeleteChangeSetWithContext(arg0 aws.Context, arg1 *cloudformation.DeleteChangeSetInput, arg2 ...request.Option) (*cloudformation.DeleteChangeSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteChangeSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DeleteChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteChangeSetWithContext indicates an expected call of DeleteChangeSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DeleteChangeSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteChangeSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteChangeSetWithContext), varargs...) +} + +// DeleteStack mocks base method. +func (m *MockCloudFormationAPI) DeleteStack(arg0 *cloudformation.DeleteStackInput) (*cloudformation.DeleteStackOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteStack", arg0) + ret0, _ := ret[0].(*cloudformation.DeleteStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteStack indicates an expected call of DeleteStack. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStack(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStack", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStack), arg0) +} + +// DeleteStackInstances mocks base method. +func (m *MockCloudFormationAPI) DeleteStackInstances(arg0 *cloudformation.DeleteStackInstancesInput) (*cloudformation.DeleteStackInstancesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteStackInstances", arg0) + ret0, _ := ret[0].(*cloudformation.DeleteStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteStackInstances indicates an expected call of DeleteStackInstances. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackInstances(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackInstances", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackInstances), arg0) +} + +// DeleteStackInstancesRequest mocks base method. +func (m *MockCloudFormationAPI) DeleteStackInstancesRequest(arg0 *cloudformation.DeleteStackInstancesInput) (*request.Request, *cloudformation.DeleteStackInstancesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteStackInstancesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DeleteStackInstancesOutput) + return ret0, ret1 +} + +// DeleteStackInstancesRequest indicates an expected call of DeleteStackInstancesRequest. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackInstancesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackInstancesRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackInstancesRequest), arg0) +} + +// DeleteStackInstancesWithContext mocks base method. +func (m *MockCloudFormationAPI) DeleteStackInstancesWithContext(arg0 aws.Context, arg1 *cloudformation.DeleteStackInstancesInput, arg2 ...request.Option) (*cloudformation.DeleteStackInstancesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteStackInstancesWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DeleteStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteStackInstancesWithContext indicates an expected call of DeleteStackInstancesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackInstancesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackInstancesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackInstancesWithContext), varargs...) +} + +// DeleteStackRequest mocks base method. +func (m *MockCloudFormationAPI) DeleteStackRequest(arg0 *cloudformation.DeleteStackInput) (*request.Request, *cloudformation.DeleteStackOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteStackRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DeleteStackOutput) + return ret0, ret1 +} + +// DeleteStackRequest indicates an expected call of DeleteStackRequest. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackRequest), arg0) +} + +// DeleteStackSet mocks base method. +func (m *MockCloudFormationAPI) DeleteStackSet(arg0 *cloudformation.DeleteStackSetInput) (*cloudformation.DeleteStackSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteStackSet", arg0) + ret0, _ := ret[0].(*cloudformation.DeleteStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteStackSet indicates an expected call of DeleteStackSet. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackSet), arg0) +} + +// DeleteStackSetRequest mocks base method. +func (m *MockCloudFormationAPI) DeleteStackSetRequest(arg0 *cloudformation.DeleteStackSetInput) (*request.Request, *cloudformation.DeleteStackSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteStackSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DeleteStackSetOutput) + return ret0, ret1 +} + +// DeleteStackSetRequest indicates an expected call of DeleteStackSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackSetRequest), arg0) +} + +// DeleteStackSetWithContext mocks base method. +func (m *MockCloudFormationAPI) DeleteStackSetWithContext(arg0 aws.Context, arg1 *cloudformation.DeleteStackSetInput, arg2 ...request.Option) (*cloudformation.DeleteStackSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteStackSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DeleteStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteStackSetWithContext indicates an expected call of DeleteStackSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackSetWithContext), varargs...) +} + +// DeleteStackWithContext mocks base method. +func (m *MockCloudFormationAPI) DeleteStackWithContext(arg0 aws.Context, arg1 *cloudformation.DeleteStackInput, arg2 ...request.Option) (*cloudformation.DeleteStackOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteStackWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DeleteStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteStackWithContext indicates an expected call of DeleteStackWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DeleteStackWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteStackWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeleteStackWithContext), varargs...) +} + +// DeregisterType mocks base method. +func (m *MockCloudFormationAPI) DeregisterType(arg0 *cloudformation.DeregisterTypeInput) (*cloudformation.DeregisterTypeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeregisterType", arg0) + ret0, _ := ret[0].(*cloudformation.DeregisterTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeregisterType indicates an expected call of DeregisterType. +func (mr *MockCloudFormationAPIMockRecorder) DeregisterType(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeregisterType", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeregisterType), arg0) +} + +// DeregisterTypeRequest mocks base method. +func (m *MockCloudFormationAPI) DeregisterTypeRequest(arg0 *cloudformation.DeregisterTypeInput) (*request.Request, *cloudformation.DeregisterTypeOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeregisterTypeRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DeregisterTypeOutput) + return ret0, ret1 +} + +// DeregisterTypeRequest indicates an expected call of DeregisterTypeRequest. +func (mr *MockCloudFormationAPIMockRecorder) DeregisterTypeRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeregisterTypeRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeregisterTypeRequest), arg0) +} + +// DeregisterTypeWithContext mocks base method. +func (m *MockCloudFormationAPI) DeregisterTypeWithContext(arg0 aws.Context, arg1 *cloudformation.DeregisterTypeInput, arg2 ...request.Option) (*cloudformation.DeregisterTypeOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeregisterTypeWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DeregisterTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeregisterTypeWithContext indicates an expected call of DeregisterTypeWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DeregisterTypeWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeregisterTypeWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DeregisterTypeWithContext), varargs...) +} + +// DescribeAccountLimits mocks base method. +func (m *MockCloudFormationAPI) DescribeAccountLimits(arg0 *cloudformation.DescribeAccountLimitsInput) (*cloudformation.DescribeAccountLimitsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeAccountLimits", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeAccountLimitsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeAccountLimits indicates an expected call of DescribeAccountLimits. +func (mr *MockCloudFormationAPIMockRecorder) DescribeAccountLimits(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeAccountLimits", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeAccountLimits), arg0) +} + +// DescribeAccountLimitsPages mocks base method. +func (m *MockCloudFormationAPI) DescribeAccountLimitsPages(arg0 *cloudformation.DescribeAccountLimitsInput, arg1 func(*cloudformation.DescribeAccountLimitsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeAccountLimitsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeAccountLimitsPages indicates an expected call of DescribeAccountLimitsPages. +func (mr *MockCloudFormationAPIMockRecorder) DescribeAccountLimitsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeAccountLimitsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeAccountLimitsPages), arg0, arg1) +} + +// DescribeAccountLimitsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeAccountLimitsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeAccountLimitsInput, arg2 func(*cloudformation.DescribeAccountLimitsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeAccountLimitsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeAccountLimitsPagesWithContext indicates an expected call of DescribeAccountLimitsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeAccountLimitsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeAccountLimitsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeAccountLimitsPagesWithContext), varargs...) +} + +// DescribeAccountLimitsRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeAccountLimitsRequest(arg0 *cloudformation.DescribeAccountLimitsInput) (*request.Request, *cloudformation.DescribeAccountLimitsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeAccountLimitsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeAccountLimitsOutput) + return ret0, ret1 +} + +// DescribeAccountLimitsRequest indicates an expected call of DescribeAccountLimitsRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeAccountLimitsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeAccountLimitsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeAccountLimitsRequest), arg0) +} + +// DescribeAccountLimitsWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeAccountLimitsWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeAccountLimitsInput, arg2 ...request.Option) (*cloudformation.DescribeAccountLimitsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeAccountLimitsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeAccountLimitsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeAccountLimitsWithContext indicates an expected call of DescribeAccountLimitsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeAccountLimitsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeAccountLimitsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeAccountLimitsWithContext), varargs...) +} + +// DescribeChangeSet mocks base method. +func (m *MockCloudFormationAPI) DescribeChangeSet(arg0 *cloudformation.DescribeChangeSetInput) (*cloudformation.DescribeChangeSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeChangeSet", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeChangeSet indicates an expected call of DescribeChangeSet. +func (mr *MockCloudFormationAPIMockRecorder) DescribeChangeSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeChangeSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeChangeSet), arg0) +} + +// DescribeChangeSetHooks mocks base method. +func (m *MockCloudFormationAPI) DescribeChangeSetHooks(arg0 *cloudformation.DescribeChangeSetHooksInput) (*cloudformation.DescribeChangeSetHooksOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeChangeSetHooks", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeChangeSetHooksOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeChangeSetHooks indicates an expected call of DescribeChangeSetHooks. +func (mr *MockCloudFormationAPIMockRecorder) DescribeChangeSetHooks(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeChangeSetHooks", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeChangeSetHooks), arg0) +} + +// DescribeChangeSetHooksRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeChangeSetHooksRequest(arg0 *cloudformation.DescribeChangeSetHooksInput) (*request.Request, *cloudformation.DescribeChangeSetHooksOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeChangeSetHooksRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeChangeSetHooksOutput) + return ret0, ret1 +} + +// DescribeChangeSetHooksRequest indicates an expected call of DescribeChangeSetHooksRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeChangeSetHooksRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeChangeSetHooksRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeChangeSetHooksRequest), arg0) +} + +// DescribeChangeSetHooksWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeChangeSetHooksWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeChangeSetHooksInput, arg2 ...request.Option) (*cloudformation.DescribeChangeSetHooksOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeChangeSetHooksWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeChangeSetHooksOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeChangeSetHooksWithContext indicates an expected call of DescribeChangeSetHooksWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeChangeSetHooksWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeChangeSetHooksWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeChangeSetHooksWithContext), varargs...) +} + +// DescribeChangeSetRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeChangeSetRequest(arg0 *cloudformation.DescribeChangeSetInput) (*request.Request, *cloudformation.DescribeChangeSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeChangeSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeChangeSetOutput) + return ret0, ret1 +} + +// DescribeChangeSetRequest indicates an expected call of DescribeChangeSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeChangeSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeChangeSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeChangeSetRequest), arg0) +} + +// DescribeChangeSetWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeChangeSetWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeChangeSetInput, arg2 ...request.Option) (*cloudformation.DescribeChangeSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeChangeSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeChangeSetWithContext indicates an expected call of DescribeChangeSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeChangeSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeChangeSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeChangeSetWithContext), varargs...) +} + +// DescribePublisher mocks base method. +func (m *MockCloudFormationAPI) DescribePublisher(arg0 *cloudformation.DescribePublisherInput) (*cloudformation.DescribePublisherOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribePublisher", arg0) + ret0, _ := ret[0].(*cloudformation.DescribePublisherOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribePublisher indicates an expected call of DescribePublisher. +func (mr *MockCloudFormationAPIMockRecorder) DescribePublisher(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribePublisher", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribePublisher), arg0) +} + +// DescribePublisherRequest mocks base method. +func (m *MockCloudFormationAPI) DescribePublisherRequest(arg0 *cloudformation.DescribePublisherInput) (*request.Request, *cloudformation.DescribePublisherOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribePublisherRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribePublisherOutput) + return ret0, ret1 +} + +// DescribePublisherRequest indicates an expected call of DescribePublisherRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribePublisherRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribePublisherRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribePublisherRequest), arg0) +} + +// DescribePublisherWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribePublisherWithContext(arg0 aws.Context, arg1 *cloudformation.DescribePublisherInput, arg2 ...request.Option) (*cloudformation.DescribePublisherOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribePublisherWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribePublisherOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribePublisherWithContext indicates an expected call of DescribePublisherWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribePublisherWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribePublisherWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribePublisherWithContext), varargs...) +} + +// DescribeStackDriftDetectionStatus mocks base method. +func (m *MockCloudFormationAPI) DescribeStackDriftDetectionStatus(arg0 *cloudformation.DescribeStackDriftDetectionStatusInput) (*cloudformation.DescribeStackDriftDetectionStatusOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackDriftDetectionStatus", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackDriftDetectionStatusOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackDriftDetectionStatus indicates an expected call of DescribeStackDriftDetectionStatus. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackDriftDetectionStatus(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackDriftDetectionStatus", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackDriftDetectionStatus), arg0) +} + +// DescribeStackDriftDetectionStatusRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackDriftDetectionStatusRequest(arg0 *cloudformation.DescribeStackDriftDetectionStatusInput) (*request.Request, *cloudformation.DescribeStackDriftDetectionStatusOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackDriftDetectionStatusRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackDriftDetectionStatusOutput) + return ret0, ret1 +} + +// DescribeStackDriftDetectionStatusRequest indicates an expected call of DescribeStackDriftDetectionStatusRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackDriftDetectionStatusRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackDriftDetectionStatusRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackDriftDetectionStatusRequest), arg0) +} + +// DescribeStackDriftDetectionStatusWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackDriftDetectionStatusWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackDriftDetectionStatusInput, arg2 ...request.Option) (*cloudformation.DescribeStackDriftDetectionStatusOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackDriftDetectionStatusWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackDriftDetectionStatusOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackDriftDetectionStatusWithContext indicates an expected call of DescribeStackDriftDetectionStatusWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackDriftDetectionStatusWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackDriftDetectionStatusWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackDriftDetectionStatusWithContext), varargs...) +} + +// DescribeStackEvents mocks base method. +func (m *MockCloudFormationAPI) DescribeStackEvents(arg0 *cloudformation.DescribeStackEventsInput) (*cloudformation.DescribeStackEventsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackEvents", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackEventsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackEvents indicates an expected call of DescribeStackEvents. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackEvents(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackEvents", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackEvents), arg0) +} + +// DescribeStackEventsPages mocks base method. +func (m *MockCloudFormationAPI) DescribeStackEventsPages(arg0 *cloudformation.DescribeStackEventsInput, arg1 func(*cloudformation.DescribeStackEventsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackEventsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeStackEventsPages indicates an expected call of DescribeStackEventsPages. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackEventsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackEventsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackEventsPages), arg0, arg1) +} + +// DescribeStackEventsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackEventsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackEventsInput, arg2 func(*cloudformation.DescribeStackEventsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackEventsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeStackEventsPagesWithContext indicates an expected call of DescribeStackEventsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackEventsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackEventsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackEventsPagesWithContext), varargs...) +} + +// DescribeStackEventsRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackEventsRequest(arg0 *cloudformation.DescribeStackEventsInput) (*request.Request, *cloudformation.DescribeStackEventsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackEventsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackEventsOutput) + return ret0, ret1 +} + +// DescribeStackEventsRequest indicates an expected call of DescribeStackEventsRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackEventsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackEventsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackEventsRequest), arg0) +} + +// DescribeStackEventsWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackEventsWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackEventsInput, arg2 ...request.Option) (*cloudformation.DescribeStackEventsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackEventsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackEventsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackEventsWithContext indicates an expected call of DescribeStackEventsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackEventsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackEventsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackEventsWithContext), varargs...) +} + +// DescribeStackInstance mocks base method. +func (m *MockCloudFormationAPI) DescribeStackInstance(arg0 *cloudformation.DescribeStackInstanceInput) (*cloudformation.DescribeStackInstanceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackInstance", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackInstanceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackInstance indicates an expected call of DescribeStackInstance. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackInstance(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackInstance", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackInstance), arg0) +} + +// DescribeStackInstanceRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackInstanceRequest(arg0 *cloudformation.DescribeStackInstanceInput) (*request.Request, *cloudformation.DescribeStackInstanceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackInstanceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackInstanceOutput) + return ret0, ret1 +} + +// DescribeStackInstanceRequest indicates an expected call of DescribeStackInstanceRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackInstanceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackInstanceRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackInstanceRequest), arg0) +} + +// DescribeStackInstanceWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackInstanceWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackInstanceInput, arg2 ...request.Option) (*cloudformation.DescribeStackInstanceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackInstanceWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackInstanceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackInstanceWithContext indicates an expected call of DescribeStackInstanceWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackInstanceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackInstanceWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackInstanceWithContext), varargs...) +} + +// DescribeStackResource mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResource(arg0 *cloudformation.DescribeStackResourceInput) (*cloudformation.DescribeStackResourceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackResource", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackResourceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackResource indicates an expected call of DescribeStackResource. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResource(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResource", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResource), arg0) +} + +// DescribeStackResourceDrifts mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourceDrifts(arg0 *cloudformation.DescribeStackResourceDriftsInput) (*cloudformation.DescribeStackResourceDriftsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackResourceDrifts", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackResourceDriftsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackResourceDrifts indicates an expected call of DescribeStackResourceDrifts. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourceDrifts(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourceDrifts", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourceDrifts), arg0) +} + +// DescribeStackResourceDriftsPages mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourceDriftsPages(arg0 *cloudformation.DescribeStackResourceDriftsInput, arg1 func(*cloudformation.DescribeStackResourceDriftsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackResourceDriftsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeStackResourceDriftsPages indicates an expected call of DescribeStackResourceDriftsPages. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourceDriftsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourceDriftsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourceDriftsPages), arg0, arg1) +} + +// DescribeStackResourceDriftsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourceDriftsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackResourceDriftsInput, arg2 func(*cloudformation.DescribeStackResourceDriftsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackResourceDriftsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeStackResourceDriftsPagesWithContext indicates an expected call of DescribeStackResourceDriftsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourceDriftsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourceDriftsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourceDriftsPagesWithContext), varargs...) +} + +// DescribeStackResourceDriftsRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourceDriftsRequest(arg0 *cloudformation.DescribeStackResourceDriftsInput) (*request.Request, *cloudformation.DescribeStackResourceDriftsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackResourceDriftsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackResourceDriftsOutput) + return ret0, ret1 +} + +// DescribeStackResourceDriftsRequest indicates an expected call of DescribeStackResourceDriftsRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourceDriftsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourceDriftsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourceDriftsRequest), arg0) +} + +// DescribeStackResourceDriftsWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourceDriftsWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackResourceDriftsInput, arg2 ...request.Option) (*cloudformation.DescribeStackResourceDriftsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackResourceDriftsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackResourceDriftsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackResourceDriftsWithContext indicates an expected call of DescribeStackResourceDriftsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourceDriftsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourceDriftsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourceDriftsWithContext), varargs...) +} + +// DescribeStackResourceRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourceRequest(arg0 *cloudformation.DescribeStackResourceInput) (*request.Request, *cloudformation.DescribeStackResourceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackResourceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackResourceOutput) + return ret0, ret1 +} + +// DescribeStackResourceRequest indicates an expected call of DescribeStackResourceRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourceRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourceRequest), arg0) +} + +// DescribeStackResourceWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourceWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackResourceInput, arg2 ...request.Option) (*cloudformation.DescribeStackResourceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackResourceWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackResourceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackResourceWithContext indicates an expected call of DescribeStackResourceWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourceWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourceWithContext), varargs...) +} + +// DescribeStackResources mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResources(arg0 *cloudformation.DescribeStackResourcesInput) (*cloudformation.DescribeStackResourcesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackResources", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackResourcesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackResources indicates an expected call of DescribeStackResources. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResources(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResources", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResources), arg0) +} + +// DescribeStackResourcesRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourcesRequest(arg0 *cloudformation.DescribeStackResourcesInput) (*request.Request, *cloudformation.DescribeStackResourcesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackResourcesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackResourcesOutput) + return ret0, ret1 +} + +// DescribeStackResourcesRequest indicates an expected call of DescribeStackResourcesRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourcesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourcesRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourcesRequest), arg0) +} + +// DescribeStackResourcesWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackResourcesWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackResourcesInput, arg2 ...request.Option) (*cloudformation.DescribeStackResourcesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackResourcesWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackResourcesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackResourcesWithContext indicates an expected call of DescribeStackResourcesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackResourcesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackResourcesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackResourcesWithContext), varargs...) +} + +// DescribeStackSet mocks base method. +func (m *MockCloudFormationAPI) DescribeStackSet(arg0 *cloudformation.DescribeStackSetInput) (*cloudformation.DescribeStackSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackSet", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackSet indicates an expected call of DescribeStackSet. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackSet), arg0) +} + +// DescribeStackSetOperation mocks base method. +func (m *MockCloudFormationAPI) DescribeStackSetOperation(arg0 *cloudformation.DescribeStackSetOperationInput) (*cloudformation.DescribeStackSetOperationOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackSetOperation", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStackSetOperationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackSetOperation indicates an expected call of DescribeStackSetOperation. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackSetOperation(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackSetOperation", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackSetOperation), arg0) +} + +// DescribeStackSetOperationRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackSetOperationRequest(arg0 *cloudformation.DescribeStackSetOperationInput) (*request.Request, *cloudformation.DescribeStackSetOperationOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackSetOperationRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackSetOperationOutput) + return ret0, ret1 +} + +// DescribeStackSetOperationRequest indicates an expected call of DescribeStackSetOperationRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackSetOperationRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackSetOperationRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackSetOperationRequest), arg0) +} + +// DescribeStackSetOperationWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackSetOperationWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackSetOperationInput, arg2 ...request.Option) (*cloudformation.DescribeStackSetOperationOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackSetOperationWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackSetOperationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackSetOperationWithContext indicates an expected call of DescribeStackSetOperationWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackSetOperationWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackSetOperationWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackSetOperationWithContext), varargs...) +} + +// DescribeStackSetRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStackSetRequest(arg0 *cloudformation.DescribeStackSetInput) (*request.Request, *cloudformation.DescribeStackSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStackSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStackSetOutput) + return ret0, ret1 +} + +// DescribeStackSetRequest indicates an expected call of DescribeStackSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackSetRequest), arg0) +} + +// DescribeStackSetWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStackSetWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStackSetInput, arg2 ...request.Option) (*cloudformation.DescribeStackSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStackSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStackSetWithContext indicates an expected call of DescribeStackSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStackSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStackSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStackSetWithContext), varargs...) +} + +// DescribeStacks mocks base method. +func (m *MockCloudFormationAPI) DescribeStacks(arg0 *cloudformation.DescribeStacksInput) (*cloudformation.DescribeStacksOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStacks", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeStacksOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStacks indicates an expected call of DescribeStacks. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStacks(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStacks", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStacks), arg0) +} + +// DescribeStacksPages mocks base method. +func (m *MockCloudFormationAPI) DescribeStacksPages(arg0 *cloudformation.DescribeStacksInput, arg1 func(*cloudformation.DescribeStacksOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStacksPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeStacksPages indicates an expected call of DescribeStacksPages. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStacksPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStacksPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStacksPages), arg0, arg1) +} + +// DescribeStacksPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStacksPagesWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 func(*cloudformation.DescribeStacksOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStacksPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DescribeStacksPagesWithContext indicates an expected call of DescribeStacksPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStacksPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStacksPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStacksPagesWithContext), varargs...) +} + +// DescribeStacksRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeStacksRequest(arg0 *cloudformation.DescribeStacksInput) (*request.Request, *cloudformation.DescribeStacksOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeStacksRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeStacksOutput) + return ret0, ret1 +} + +// DescribeStacksRequest indicates an expected call of DescribeStacksRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStacksRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStacksRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStacksRequest), arg0) +} + +// DescribeStacksWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeStacksWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 ...request.Option) (*cloudformation.DescribeStacksOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeStacksWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeStacksOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeStacksWithContext indicates an expected call of DescribeStacksWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeStacksWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeStacksWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeStacksWithContext), varargs...) +} + +// DescribeType mocks base method. +func (m *MockCloudFormationAPI) DescribeType(arg0 *cloudformation.DescribeTypeInput) (*cloudformation.DescribeTypeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeType", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeType indicates an expected call of DescribeType. +func (mr *MockCloudFormationAPIMockRecorder) DescribeType(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeType", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeType), arg0) +} + +// DescribeTypeRegistration mocks base method. +func (m *MockCloudFormationAPI) DescribeTypeRegistration(arg0 *cloudformation.DescribeTypeRegistrationInput) (*cloudformation.DescribeTypeRegistrationOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeTypeRegistration", arg0) + ret0, _ := ret[0].(*cloudformation.DescribeTypeRegistrationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeTypeRegistration indicates an expected call of DescribeTypeRegistration. +func (mr *MockCloudFormationAPIMockRecorder) DescribeTypeRegistration(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeTypeRegistration", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeTypeRegistration), arg0) +} + +// DescribeTypeRegistrationRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeTypeRegistrationRequest(arg0 *cloudformation.DescribeTypeRegistrationInput) (*request.Request, *cloudformation.DescribeTypeRegistrationOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeTypeRegistrationRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeTypeRegistrationOutput) + return ret0, ret1 +} + +// DescribeTypeRegistrationRequest indicates an expected call of DescribeTypeRegistrationRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeTypeRegistrationRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeTypeRegistrationRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeTypeRegistrationRequest), arg0) +} + +// DescribeTypeRegistrationWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeTypeRegistrationWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeTypeRegistrationInput, arg2 ...request.Option) (*cloudformation.DescribeTypeRegistrationOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeTypeRegistrationWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeTypeRegistrationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeTypeRegistrationWithContext indicates an expected call of DescribeTypeRegistrationWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeTypeRegistrationWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeTypeRegistrationWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeTypeRegistrationWithContext), varargs...) +} + +// DescribeTypeRequest mocks base method. +func (m *MockCloudFormationAPI) DescribeTypeRequest(arg0 *cloudformation.DescribeTypeInput) (*request.Request, *cloudformation.DescribeTypeOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DescribeTypeRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DescribeTypeOutput) + return ret0, ret1 +} + +// DescribeTypeRequest indicates an expected call of DescribeTypeRequest. +func (mr *MockCloudFormationAPIMockRecorder) DescribeTypeRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeTypeRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeTypeRequest), arg0) +} + +// DescribeTypeWithContext mocks base method. +func (m *MockCloudFormationAPI) DescribeTypeWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeTypeInput, arg2 ...request.Option) (*cloudformation.DescribeTypeOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DescribeTypeWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DescribeTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DescribeTypeWithContext indicates an expected call of DescribeTypeWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DescribeTypeWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DescribeTypeWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DescribeTypeWithContext), varargs...) +} + +// DetectStackDrift mocks base method. +func (m *MockCloudFormationAPI) DetectStackDrift(arg0 *cloudformation.DetectStackDriftInput) (*cloudformation.DetectStackDriftOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetectStackDrift", arg0) + ret0, _ := ret[0].(*cloudformation.DetectStackDriftOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetectStackDrift indicates an expected call of DetectStackDrift. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackDrift(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackDrift", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackDrift), arg0) +} + +// DetectStackDriftRequest mocks base method. +func (m *MockCloudFormationAPI) DetectStackDriftRequest(arg0 *cloudformation.DetectStackDriftInput) (*request.Request, *cloudformation.DetectStackDriftOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetectStackDriftRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DetectStackDriftOutput) + return ret0, ret1 +} + +// DetectStackDriftRequest indicates an expected call of DetectStackDriftRequest. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackDriftRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackDriftRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackDriftRequest), arg0) +} + +// DetectStackDriftWithContext mocks base method. +func (m *MockCloudFormationAPI) DetectStackDriftWithContext(arg0 aws.Context, arg1 *cloudformation.DetectStackDriftInput, arg2 ...request.Option) (*cloudformation.DetectStackDriftOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DetectStackDriftWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DetectStackDriftOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetectStackDriftWithContext indicates an expected call of DetectStackDriftWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackDriftWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackDriftWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackDriftWithContext), varargs...) +} + +// DetectStackResourceDrift mocks base method. +func (m *MockCloudFormationAPI) DetectStackResourceDrift(arg0 *cloudformation.DetectStackResourceDriftInput) (*cloudformation.DetectStackResourceDriftOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetectStackResourceDrift", arg0) + ret0, _ := ret[0].(*cloudformation.DetectStackResourceDriftOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetectStackResourceDrift indicates an expected call of DetectStackResourceDrift. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackResourceDrift(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackResourceDrift", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackResourceDrift), arg0) +} + +// DetectStackResourceDriftRequest mocks base method. +func (m *MockCloudFormationAPI) DetectStackResourceDriftRequest(arg0 *cloudformation.DetectStackResourceDriftInput) (*request.Request, *cloudformation.DetectStackResourceDriftOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetectStackResourceDriftRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DetectStackResourceDriftOutput) + return ret0, ret1 +} + +// DetectStackResourceDriftRequest indicates an expected call of DetectStackResourceDriftRequest. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackResourceDriftRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackResourceDriftRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackResourceDriftRequest), arg0) +} + +// DetectStackResourceDriftWithContext mocks base method. +func (m *MockCloudFormationAPI) DetectStackResourceDriftWithContext(arg0 aws.Context, arg1 *cloudformation.DetectStackResourceDriftInput, arg2 ...request.Option) (*cloudformation.DetectStackResourceDriftOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DetectStackResourceDriftWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DetectStackResourceDriftOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetectStackResourceDriftWithContext indicates an expected call of DetectStackResourceDriftWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackResourceDriftWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackResourceDriftWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackResourceDriftWithContext), varargs...) +} + +// DetectStackSetDrift mocks base method. +func (m *MockCloudFormationAPI) DetectStackSetDrift(arg0 *cloudformation.DetectStackSetDriftInput) (*cloudformation.DetectStackSetDriftOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetectStackSetDrift", arg0) + ret0, _ := ret[0].(*cloudformation.DetectStackSetDriftOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetectStackSetDrift indicates an expected call of DetectStackSetDrift. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackSetDrift(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackSetDrift", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackSetDrift), arg0) +} + +// DetectStackSetDriftRequest mocks base method. +func (m *MockCloudFormationAPI) DetectStackSetDriftRequest(arg0 *cloudformation.DetectStackSetDriftInput) (*request.Request, *cloudformation.DetectStackSetDriftOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetectStackSetDriftRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.DetectStackSetDriftOutput) + return ret0, ret1 +} + +// DetectStackSetDriftRequest indicates an expected call of DetectStackSetDriftRequest. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackSetDriftRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackSetDriftRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackSetDriftRequest), arg0) +} + +// DetectStackSetDriftWithContext mocks base method. +func (m *MockCloudFormationAPI) DetectStackSetDriftWithContext(arg0 aws.Context, arg1 *cloudformation.DetectStackSetDriftInput, arg2 ...request.Option) (*cloudformation.DetectStackSetDriftOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DetectStackSetDriftWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.DetectStackSetDriftOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetectStackSetDriftWithContext indicates an expected call of DetectStackSetDriftWithContext. +func (mr *MockCloudFormationAPIMockRecorder) DetectStackSetDriftWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetectStackSetDriftWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).DetectStackSetDriftWithContext), varargs...) +} + +// EstimateTemplateCost mocks base method. +func (m *MockCloudFormationAPI) EstimateTemplateCost(arg0 *cloudformation.EstimateTemplateCostInput) (*cloudformation.EstimateTemplateCostOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EstimateTemplateCost", arg0) + ret0, _ := ret[0].(*cloudformation.EstimateTemplateCostOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EstimateTemplateCost indicates an expected call of EstimateTemplateCost. +func (mr *MockCloudFormationAPIMockRecorder) EstimateTemplateCost(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimateTemplateCost", reflect.TypeOf((*MockCloudFormationAPI)(nil).EstimateTemplateCost), arg0) +} + +// EstimateTemplateCostRequest mocks base method. +func (m *MockCloudFormationAPI) EstimateTemplateCostRequest(arg0 *cloudformation.EstimateTemplateCostInput) (*request.Request, *cloudformation.EstimateTemplateCostOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EstimateTemplateCostRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.EstimateTemplateCostOutput) + return ret0, ret1 +} + +// EstimateTemplateCostRequest indicates an expected call of EstimateTemplateCostRequest. +func (mr *MockCloudFormationAPIMockRecorder) EstimateTemplateCostRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimateTemplateCostRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).EstimateTemplateCostRequest), arg0) +} + +// EstimateTemplateCostWithContext mocks base method. +func (m *MockCloudFormationAPI) EstimateTemplateCostWithContext(arg0 aws.Context, arg1 *cloudformation.EstimateTemplateCostInput, arg2 ...request.Option) (*cloudformation.EstimateTemplateCostOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "EstimateTemplateCostWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.EstimateTemplateCostOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EstimateTemplateCostWithContext indicates an expected call of EstimateTemplateCostWithContext. +func (mr *MockCloudFormationAPIMockRecorder) EstimateTemplateCostWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimateTemplateCostWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).EstimateTemplateCostWithContext), varargs...) +} + +// ExecuteChangeSet mocks base method. +func (m *MockCloudFormationAPI) ExecuteChangeSet(arg0 *cloudformation.ExecuteChangeSetInput) (*cloudformation.ExecuteChangeSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ExecuteChangeSet", arg0) + ret0, _ := ret[0].(*cloudformation.ExecuteChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ExecuteChangeSet indicates an expected call of ExecuteChangeSet. +func (mr *MockCloudFormationAPIMockRecorder) ExecuteChangeSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteChangeSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).ExecuteChangeSet), arg0) +} + +// ExecuteChangeSetRequest mocks base method. +func (m *MockCloudFormationAPI) ExecuteChangeSetRequest(arg0 *cloudformation.ExecuteChangeSetInput) (*request.Request, *cloudformation.ExecuteChangeSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ExecuteChangeSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ExecuteChangeSetOutput) + return ret0, ret1 +} + +// ExecuteChangeSetRequest indicates an expected call of ExecuteChangeSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) ExecuteChangeSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteChangeSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ExecuteChangeSetRequest), arg0) +} + +// ExecuteChangeSetWithContext mocks base method. +func (m *MockCloudFormationAPI) ExecuteChangeSetWithContext(arg0 aws.Context, arg1 *cloudformation.ExecuteChangeSetInput, arg2 ...request.Option) (*cloudformation.ExecuteChangeSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ExecuteChangeSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ExecuteChangeSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ExecuteChangeSetWithContext indicates an expected call of ExecuteChangeSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ExecuteChangeSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteChangeSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ExecuteChangeSetWithContext), varargs...) +} + +// GetStackPolicy mocks base method. +func (m *MockCloudFormationAPI) GetStackPolicy(arg0 *cloudformation.GetStackPolicyInput) (*cloudformation.GetStackPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetStackPolicy", arg0) + ret0, _ := ret[0].(*cloudformation.GetStackPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetStackPolicy indicates an expected call of GetStackPolicy. +func (mr *MockCloudFormationAPIMockRecorder) GetStackPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStackPolicy", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetStackPolicy), arg0) +} + +// GetStackPolicyRequest mocks base method. +func (m *MockCloudFormationAPI) GetStackPolicyRequest(arg0 *cloudformation.GetStackPolicyInput) (*request.Request, *cloudformation.GetStackPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetStackPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.GetStackPolicyOutput) + return ret0, ret1 +} + +// GetStackPolicyRequest indicates an expected call of GetStackPolicyRequest. +func (mr *MockCloudFormationAPIMockRecorder) GetStackPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStackPolicyRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetStackPolicyRequest), arg0) +} + +// GetStackPolicyWithContext mocks base method. +func (m *MockCloudFormationAPI) GetStackPolicyWithContext(arg0 aws.Context, arg1 *cloudformation.GetStackPolicyInput, arg2 ...request.Option) (*cloudformation.GetStackPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetStackPolicyWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.GetStackPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetStackPolicyWithContext indicates an expected call of GetStackPolicyWithContext. +func (mr *MockCloudFormationAPIMockRecorder) GetStackPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStackPolicyWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetStackPolicyWithContext), varargs...) +} + +// GetTemplate mocks base method. +func (m *MockCloudFormationAPI) GetTemplate(arg0 *cloudformation.GetTemplateInput) (*cloudformation.GetTemplateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTemplate", arg0) + ret0, _ := ret[0].(*cloudformation.GetTemplateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTemplate indicates an expected call of GetTemplate. +func (mr *MockCloudFormationAPIMockRecorder) GetTemplate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplate", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetTemplate), arg0) +} + +// GetTemplateRequest mocks base method. +func (m *MockCloudFormationAPI) GetTemplateRequest(arg0 *cloudformation.GetTemplateInput) (*request.Request, *cloudformation.GetTemplateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTemplateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.GetTemplateOutput) + return ret0, ret1 +} + +// GetTemplateRequest indicates an expected call of GetTemplateRequest. +func (mr *MockCloudFormationAPIMockRecorder) GetTemplateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplateRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetTemplateRequest), arg0) +} + +// GetTemplateSummary mocks base method. +func (m *MockCloudFormationAPI) GetTemplateSummary(arg0 *cloudformation.GetTemplateSummaryInput) (*cloudformation.GetTemplateSummaryOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTemplateSummary", arg0) + ret0, _ := ret[0].(*cloudformation.GetTemplateSummaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTemplateSummary indicates an expected call of GetTemplateSummary. +func (mr *MockCloudFormationAPIMockRecorder) GetTemplateSummary(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplateSummary", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetTemplateSummary), arg0) +} + +// GetTemplateSummaryRequest mocks base method. +func (m *MockCloudFormationAPI) GetTemplateSummaryRequest(arg0 *cloudformation.GetTemplateSummaryInput) (*request.Request, *cloudformation.GetTemplateSummaryOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTemplateSummaryRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.GetTemplateSummaryOutput) + return ret0, ret1 +} + +// GetTemplateSummaryRequest indicates an expected call of GetTemplateSummaryRequest. +func (mr *MockCloudFormationAPIMockRecorder) GetTemplateSummaryRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplateSummaryRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetTemplateSummaryRequest), arg0) +} + +// GetTemplateSummaryWithContext mocks base method. +func (m *MockCloudFormationAPI) GetTemplateSummaryWithContext(arg0 aws.Context, arg1 *cloudformation.GetTemplateSummaryInput, arg2 ...request.Option) (*cloudformation.GetTemplateSummaryOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetTemplateSummaryWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.GetTemplateSummaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTemplateSummaryWithContext indicates an expected call of GetTemplateSummaryWithContext. +func (mr *MockCloudFormationAPIMockRecorder) GetTemplateSummaryWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplateSummaryWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetTemplateSummaryWithContext), varargs...) +} + +// GetTemplateWithContext mocks base method. +func (m *MockCloudFormationAPI) GetTemplateWithContext(arg0 aws.Context, arg1 *cloudformation.GetTemplateInput, arg2 ...request.Option) (*cloudformation.GetTemplateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetTemplateWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.GetTemplateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTemplateWithContext indicates an expected call of GetTemplateWithContext. +func (mr *MockCloudFormationAPIMockRecorder) GetTemplateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplateWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).GetTemplateWithContext), varargs...) +} + +// ImportStacksToStackSet mocks base method. +func (m *MockCloudFormationAPI) ImportStacksToStackSet(arg0 *cloudformation.ImportStacksToStackSetInput) (*cloudformation.ImportStacksToStackSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImportStacksToStackSet", arg0) + ret0, _ := ret[0].(*cloudformation.ImportStacksToStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImportStacksToStackSet indicates an expected call of ImportStacksToStackSet. +func (mr *MockCloudFormationAPIMockRecorder) ImportStacksToStackSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportStacksToStackSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).ImportStacksToStackSet), arg0) +} + +// ImportStacksToStackSetRequest mocks base method. +func (m *MockCloudFormationAPI) ImportStacksToStackSetRequest(arg0 *cloudformation.ImportStacksToStackSetInput) (*request.Request, *cloudformation.ImportStacksToStackSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImportStacksToStackSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ImportStacksToStackSetOutput) + return ret0, ret1 +} + +// ImportStacksToStackSetRequest indicates an expected call of ImportStacksToStackSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) ImportStacksToStackSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportStacksToStackSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ImportStacksToStackSetRequest), arg0) +} + +// ImportStacksToStackSetWithContext mocks base method. +func (m *MockCloudFormationAPI) ImportStacksToStackSetWithContext(arg0 aws.Context, arg1 *cloudformation.ImportStacksToStackSetInput, arg2 ...request.Option) (*cloudformation.ImportStacksToStackSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ImportStacksToStackSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ImportStacksToStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImportStacksToStackSetWithContext indicates an expected call of ImportStacksToStackSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ImportStacksToStackSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportStacksToStackSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ImportStacksToStackSetWithContext), varargs...) +} + +// ListChangeSets mocks base method. +func (m *MockCloudFormationAPI) ListChangeSets(arg0 *cloudformation.ListChangeSetsInput) (*cloudformation.ListChangeSetsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListChangeSets", arg0) + ret0, _ := ret[0].(*cloudformation.ListChangeSetsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListChangeSets indicates an expected call of ListChangeSets. +func (mr *MockCloudFormationAPIMockRecorder) ListChangeSets(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListChangeSets", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListChangeSets), arg0) +} + +// ListChangeSetsPages mocks base method. +func (m *MockCloudFormationAPI) ListChangeSetsPages(arg0 *cloudformation.ListChangeSetsInput, arg1 func(*cloudformation.ListChangeSetsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListChangeSetsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListChangeSetsPages indicates an expected call of ListChangeSetsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListChangeSetsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListChangeSetsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListChangeSetsPages), arg0, arg1) +} + +// ListChangeSetsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListChangeSetsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListChangeSetsInput, arg2 func(*cloudformation.ListChangeSetsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListChangeSetsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListChangeSetsPagesWithContext indicates an expected call of ListChangeSetsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListChangeSetsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListChangeSetsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListChangeSetsPagesWithContext), varargs...) +} + +// ListChangeSetsRequest mocks base method. +func (m *MockCloudFormationAPI) ListChangeSetsRequest(arg0 *cloudformation.ListChangeSetsInput) (*request.Request, *cloudformation.ListChangeSetsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListChangeSetsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListChangeSetsOutput) + return ret0, ret1 +} + +// ListChangeSetsRequest indicates an expected call of ListChangeSetsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListChangeSetsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListChangeSetsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListChangeSetsRequest), arg0) +} + +// ListChangeSetsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListChangeSetsWithContext(arg0 aws.Context, arg1 *cloudformation.ListChangeSetsInput, arg2 ...request.Option) (*cloudformation.ListChangeSetsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListChangeSetsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListChangeSetsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListChangeSetsWithContext indicates an expected call of ListChangeSetsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListChangeSetsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListChangeSetsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListChangeSetsWithContext), varargs...) +} + +// ListExports mocks base method. +func (m *MockCloudFormationAPI) ListExports(arg0 *cloudformation.ListExportsInput) (*cloudformation.ListExportsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListExports", arg0) + ret0, _ := ret[0].(*cloudformation.ListExportsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListExports indicates an expected call of ListExports. +func (mr *MockCloudFormationAPIMockRecorder) ListExports(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListExports", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListExports), arg0) +} + +// ListExportsPages mocks base method. +func (m *MockCloudFormationAPI) ListExportsPages(arg0 *cloudformation.ListExportsInput, arg1 func(*cloudformation.ListExportsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListExportsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListExportsPages indicates an expected call of ListExportsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListExportsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListExportsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListExportsPages), arg0, arg1) +} + +// ListExportsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListExportsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListExportsInput, arg2 func(*cloudformation.ListExportsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListExportsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListExportsPagesWithContext indicates an expected call of ListExportsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListExportsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListExportsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListExportsPagesWithContext), varargs...) +} + +// ListExportsRequest mocks base method. +func (m *MockCloudFormationAPI) ListExportsRequest(arg0 *cloudformation.ListExportsInput) (*request.Request, *cloudformation.ListExportsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListExportsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListExportsOutput) + return ret0, ret1 +} + +// ListExportsRequest indicates an expected call of ListExportsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListExportsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListExportsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListExportsRequest), arg0) +} + +// ListExportsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListExportsWithContext(arg0 aws.Context, arg1 *cloudformation.ListExportsInput, arg2 ...request.Option) (*cloudformation.ListExportsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListExportsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListExportsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListExportsWithContext indicates an expected call of ListExportsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListExportsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListExportsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListExportsWithContext), varargs...) +} + +// ListImports mocks base method. +func (m *MockCloudFormationAPI) ListImports(arg0 *cloudformation.ListImportsInput) (*cloudformation.ListImportsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListImports", arg0) + ret0, _ := ret[0].(*cloudformation.ListImportsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListImports indicates an expected call of ListImports. +func (mr *MockCloudFormationAPIMockRecorder) ListImports(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListImports", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListImports), arg0) +} + +// ListImportsPages mocks base method. +func (m *MockCloudFormationAPI) ListImportsPages(arg0 *cloudformation.ListImportsInput, arg1 func(*cloudformation.ListImportsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListImportsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListImportsPages indicates an expected call of ListImportsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListImportsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListImportsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListImportsPages), arg0, arg1) +} + +// ListImportsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListImportsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListImportsInput, arg2 func(*cloudformation.ListImportsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListImportsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListImportsPagesWithContext indicates an expected call of ListImportsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListImportsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListImportsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListImportsPagesWithContext), varargs...) +} + +// ListImportsRequest mocks base method. +func (m *MockCloudFormationAPI) ListImportsRequest(arg0 *cloudformation.ListImportsInput) (*request.Request, *cloudformation.ListImportsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListImportsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListImportsOutput) + return ret0, ret1 +} + +// ListImportsRequest indicates an expected call of ListImportsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListImportsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListImportsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListImportsRequest), arg0) +} + +// ListImportsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListImportsWithContext(arg0 aws.Context, arg1 *cloudformation.ListImportsInput, arg2 ...request.Option) (*cloudformation.ListImportsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListImportsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListImportsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListImportsWithContext indicates an expected call of ListImportsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListImportsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListImportsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListImportsWithContext), varargs...) +} + +// ListStackInstances mocks base method. +func (m *MockCloudFormationAPI) ListStackInstances(arg0 *cloudformation.ListStackInstancesInput) (*cloudformation.ListStackInstancesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackInstances", arg0) + ret0, _ := ret[0].(*cloudformation.ListStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackInstances indicates an expected call of ListStackInstances. +func (mr *MockCloudFormationAPIMockRecorder) ListStackInstances(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackInstances", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackInstances), arg0) +} + +// ListStackInstancesPages mocks base method. +func (m *MockCloudFormationAPI) ListStackInstancesPages(arg0 *cloudformation.ListStackInstancesInput, arg1 func(*cloudformation.ListStackInstancesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackInstancesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackInstancesPages indicates an expected call of ListStackInstancesPages. +func (mr *MockCloudFormationAPIMockRecorder) ListStackInstancesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackInstancesPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackInstancesPages), arg0, arg1) +} + +// ListStackInstancesPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackInstancesPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackInstancesInput, arg2 func(*cloudformation.ListStackInstancesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackInstancesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackInstancesPagesWithContext indicates an expected call of ListStackInstancesPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackInstancesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackInstancesPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackInstancesPagesWithContext), varargs...) +} + +// ListStackInstancesRequest mocks base method. +func (m *MockCloudFormationAPI) ListStackInstancesRequest(arg0 *cloudformation.ListStackInstancesInput) (*request.Request, *cloudformation.ListStackInstancesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackInstancesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListStackInstancesOutput) + return ret0, ret1 +} + +// ListStackInstancesRequest indicates an expected call of ListStackInstancesRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListStackInstancesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackInstancesRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackInstancesRequest), arg0) +} + +// ListStackInstancesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackInstancesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackInstancesInput, arg2 ...request.Option) (*cloudformation.ListStackInstancesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackInstancesWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackInstancesWithContext indicates an expected call of ListStackInstancesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackInstancesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackInstancesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackInstancesWithContext), varargs...) +} + +// ListStackResources mocks base method. +func (m *MockCloudFormationAPI) ListStackResources(arg0 *cloudformation.ListStackResourcesInput) (*cloudformation.ListStackResourcesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackResources", arg0) + ret0, _ := ret[0].(*cloudformation.ListStackResourcesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackResources indicates an expected call of ListStackResources. +func (mr *MockCloudFormationAPIMockRecorder) ListStackResources(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackResources", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackResources), arg0) +} + +// ListStackResourcesPages mocks base method. +func (m *MockCloudFormationAPI) ListStackResourcesPages(arg0 *cloudformation.ListStackResourcesInput, arg1 func(*cloudformation.ListStackResourcesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackResourcesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackResourcesPages indicates an expected call of ListStackResourcesPages. +func (mr *MockCloudFormationAPIMockRecorder) ListStackResourcesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackResourcesPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackResourcesPages), arg0, arg1) +} + +// ListStackResourcesPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackResourcesPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackResourcesInput, arg2 func(*cloudformation.ListStackResourcesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackResourcesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackResourcesPagesWithContext indicates an expected call of ListStackResourcesPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackResourcesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackResourcesPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackResourcesPagesWithContext), varargs...) +} + +// ListStackResourcesRequest mocks base method. +func (m *MockCloudFormationAPI) ListStackResourcesRequest(arg0 *cloudformation.ListStackResourcesInput) (*request.Request, *cloudformation.ListStackResourcesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackResourcesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListStackResourcesOutput) + return ret0, ret1 +} + +// ListStackResourcesRequest indicates an expected call of ListStackResourcesRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListStackResourcesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackResourcesRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackResourcesRequest), arg0) +} + +// ListStackResourcesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackResourcesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackResourcesInput, arg2 ...request.Option) (*cloudformation.ListStackResourcesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackResourcesWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListStackResourcesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackResourcesWithContext indicates an expected call of ListStackResourcesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackResourcesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackResourcesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackResourcesWithContext), varargs...) +} + +// ListStackSetOperationResults mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationResults(arg0 *cloudformation.ListStackSetOperationResultsInput) (*cloudformation.ListStackSetOperationResultsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetOperationResults", arg0) + ret0, _ := ret[0].(*cloudformation.ListStackSetOperationResultsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackSetOperationResults indicates an expected call of ListStackSetOperationResults. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationResults(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationResults", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationResults), arg0) +} + +// ListStackSetOperationResultsPages mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationResultsPages(arg0 *cloudformation.ListStackSetOperationResultsInput, arg1 func(*cloudformation.ListStackSetOperationResultsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetOperationResultsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackSetOperationResultsPages indicates an expected call of ListStackSetOperationResultsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationResultsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationResultsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationResultsPages), arg0, arg1) +} + +// ListStackSetOperationResultsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationResultsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackSetOperationResultsInput, arg2 func(*cloudformation.ListStackSetOperationResultsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackSetOperationResultsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackSetOperationResultsPagesWithContext indicates an expected call of ListStackSetOperationResultsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationResultsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationResultsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationResultsPagesWithContext), varargs...) +} + +// ListStackSetOperationResultsRequest mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationResultsRequest(arg0 *cloudformation.ListStackSetOperationResultsInput) (*request.Request, *cloudformation.ListStackSetOperationResultsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetOperationResultsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListStackSetOperationResultsOutput) + return ret0, ret1 +} + +// ListStackSetOperationResultsRequest indicates an expected call of ListStackSetOperationResultsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationResultsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationResultsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationResultsRequest), arg0) +} + +// ListStackSetOperationResultsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationResultsWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackSetOperationResultsInput, arg2 ...request.Option) (*cloudformation.ListStackSetOperationResultsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackSetOperationResultsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListStackSetOperationResultsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackSetOperationResultsWithContext indicates an expected call of ListStackSetOperationResultsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationResultsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationResultsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationResultsWithContext), varargs...) +} + +// ListStackSetOperations mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperations(arg0 *cloudformation.ListStackSetOperationsInput) (*cloudformation.ListStackSetOperationsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetOperations", arg0) + ret0, _ := ret[0].(*cloudformation.ListStackSetOperationsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackSetOperations indicates an expected call of ListStackSetOperations. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperations(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperations", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperations), arg0) +} + +// ListStackSetOperationsPages mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationsPages(arg0 *cloudformation.ListStackSetOperationsInput, arg1 func(*cloudformation.ListStackSetOperationsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetOperationsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackSetOperationsPages indicates an expected call of ListStackSetOperationsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationsPages), arg0, arg1) +} + +// ListStackSetOperationsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackSetOperationsInput, arg2 func(*cloudformation.ListStackSetOperationsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackSetOperationsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackSetOperationsPagesWithContext indicates an expected call of ListStackSetOperationsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationsPagesWithContext), varargs...) +} + +// ListStackSetOperationsRequest mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationsRequest(arg0 *cloudformation.ListStackSetOperationsInput) (*request.Request, *cloudformation.ListStackSetOperationsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetOperationsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListStackSetOperationsOutput) + return ret0, ret1 +} + +// ListStackSetOperationsRequest indicates an expected call of ListStackSetOperationsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationsRequest), arg0) +} + +// ListStackSetOperationsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackSetOperationsWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackSetOperationsInput, arg2 ...request.Option) (*cloudformation.ListStackSetOperationsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackSetOperationsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListStackSetOperationsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackSetOperationsWithContext indicates an expected call of ListStackSetOperationsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetOperationsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetOperationsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetOperationsWithContext), varargs...) +} + +// ListStackSets mocks base method. +func (m *MockCloudFormationAPI) ListStackSets(arg0 *cloudformation.ListStackSetsInput) (*cloudformation.ListStackSetsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSets", arg0) + ret0, _ := ret[0].(*cloudformation.ListStackSetsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackSets indicates an expected call of ListStackSets. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSets(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSets", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSets), arg0) +} + +// ListStackSetsPages mocks base method. +func (m *MockCloudFormationAPI) ListStackSetsPages(arg0 *cloudformation.ListStackSetsInput, arg1 func(*cloudformation.ListStackSetsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackSetsPages indicates an expected call of ListStackSetsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetsPages), arg0, arg1) +} + +// ListStackSetsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackSetsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackSetsInput, arg2 func(*cloudformation.ListStackSetsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackSetsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStackSetsPagesWithContext indicates an expected call of ListStackSetsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetsPagesWithContext), varargs...) +} + +// ListStackSetsRequest mocks base method. +func (m *MockCloudFormationAPI) ListStackSetsRequest(arg0 *cloudformation.ListStackSetsInput) (*request.Request, *cloudformation.ListStackSetsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStackSetsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListStackSetsOutput) + return ret0, ret1 +} + +// ListStackSetsRequest indicates an expected call of ListStackSetsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetsRequest), arg0) +} + +// ListStackSetsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStackSetsWithContext(arg0 aws.Context, arg1 *cloudformation.ListStackSetsInput, arg2 ...request.Option) (*cloudformation.ListStackSetsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStackSetsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListStackSetsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStackSetsWithContext indicates an expected call of ListStackSetsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStackSetsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStackSetsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStackSetsWithContext), varargs...) +} + +// ListStacks mocks base method. +func (m *MockCloudFormationAPI) ListStacks(arg0 *cloudformation.ListStacksInput) (*cloudformation.ListStacksOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStacks", arg0) + ret0, _ := ret[0].(*cloudformation.ListStacksOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStacks indicates an expected call of ListStacks. +func (mr *MockCloudFormationAPIMockRecorder) ListStacks(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStacks", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStacks), arg0) +} + +// ListStacksPages mocks base method. +func (m *MockCloudFormationAPI) ListStacksPages(arg0 *cloudformation.ListStacksInput, arg1 func(*cloudformation.ListStacksOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStacksPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStacksPages indicates an expected call of ListStacksPages. +func (mr *MockCloudFormationAPIMockRecorder) ListStacksPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStacksPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStacksPages), arg0, arg1) +} + +// ListStacksPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStacksPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListStacksInput, arg2 func(*cloudformation.ListStacksOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStacksPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListStacksPagesWithContext indicates an expected call of ListStacksPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStacksPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStacksPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStacksPagesWithContext), varargs...) +} + +// ListStacksRequest mocks base method. +func (m *MockCloudFormationAPI) ListStacksRequest(arg0 *cloudformation.ListStacksInput) (*request.Request, *cloudformation.ListStacksOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListStacksRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListStacksOutput) + return ret0, ret1 +} + +// ListStacksRequest indicates an expected call of ListStacksRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListStacksRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStacksRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStacksRequest), arg0) +} + +// ListStacksWithContext mocks base method. +func (m *MockCloudFormationAPI) ListStacksWithContext(arg0 aws.Context, arg1 *cloudformation.ListStacksInput, arg2 ...request.Option) (*cloudformation.ListStacksOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListStacksWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListStacksOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListStacksWithContext indicates an expected call of ListStacksWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListStacksWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStacksWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListStacksWithContext), varargs...) +} + +// ListTypeRegistrations mocks base method. +func (m *MockCloudFormationAPI) ListTypeRegistrations(arg0 *cloudformation.ListTypeRegistrationsInput) (*cloudformation.ListTypeRegistrationsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypeRegistrations", arg0) + ret0, _ := ret[0].(*cloudformation.ListTypeRegistrationsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypeRegistrations indicates an expected call of ListTypeRegistrations. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeRegistrations(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeRegistrations", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeRegistrations), arg0) +} + +// ListTypeRegistrationsPages mocks base method. +func (m *MockCloudFormationAPI) ListTypeRegistrationsPages(arg0 *cloudformation.ListTypeRegistrationsInput, arg1 func(*cloudformation.ListTypeRegistrationsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypeRegistrationsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListTypeRegistrationsPages indicates an expected call of ListTypeRegistrationsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeRegistrationsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeRegistrationsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeRegistrationsPages), arg0, arg1) +} + +// ListTypeRegistrationsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListTypeRegistrationsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListTypeRegistrationsInput, arg2 func(*cloudformation.ListTypeRegistrationsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListTypeRegistrationsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListTypeRegistrationsPagesWithContext indicates an expected call of ListTypeRegistrationsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeRegistrationsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeRegistrationsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeRegistrationsPagesWithContext), varargs...) +} + +// ListTypeRegistrationsRequest mocks base method. +func (m *MockCloudFormationAPI) ListTypeRegistrationsRequest(arg0 *cloudformation.ListTypeRegistrationsInput) (*request.Request, *cloudformation.ListTypeRegistrationsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypeRegistrationsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListTypeRegistrationsOutput) + return ret0, ret1 +} + +// ListTypeRegistrationsRequest indicates an expected call of ListTypeRegistrationsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeRegistrationsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeRegistrationsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeRegistrationsRequest), arg0) +} + +// ListTypeRegistrationsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListTypeRegistrationsWithContext(arg0 aws.Context, arg1 *cloudformation.ListTypeRegistrationsInput, arg2 ...request.Option) (*cloudformation.ListTypeRegistrationsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListTypeRegistrationsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListTypeRegistrationsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypeRegistrationsWithContext indicates an expected call of ListTypeRegistrationsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeRegistrationsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeRegistrationsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeRegistrationsWithContext), varargs...) +} + +// ListTypeVersions mocks base method. +func (m *MockCloudFormationAPI) ListTypeVersions(arg0 *cloudformation.ListTypeVersionsInput) (*cloudformation.ListTypeVersionsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypeVersions", arg0) + ret0, _ := ret[0].(*cloudformation.ListTypeVersionsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypeVersions indicates an expected call of ListTypeVersions. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeVersions(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeVersions", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeVersions), arg0) +} + +// ListTypeVersionsPages mocks base method. +func (m *MockCloudFormationAPI) ListTypeVersionsPages(arg0 *cloudformation.ListTypeVersionsInput, arg1 func(*cloudformation.ListTypeVersionsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypeVersionsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListTypeVersionsPages indicates an expected call of ListTypeVersionsPages. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeVersionsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeVersionsPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeVersionsPages), arg0, arg1) +} + +// ListTypeVersionsPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListTypeVersionsPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListTypeVersionsInput, arg2 func(*cloudformation.ListTypeVersionsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListTypeVersionsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListTypeVersionsPagesWithContext indicates an expected call of ListTypeVersionsPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeVersionsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeVersionsPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeVersionsPagesWithContext), varargs...) +} + +// ListTypeVersionsRequest mocks base method. +func (m *MockCloudFormationAPI) ListTypeVersionsRequest(arg0 *cloudformation.ListTypeVersionsInput) (*request.Request, *cloudformation.ListTypeVersionsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypeVersionsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListTypeVersionsOutput) + return ret0, ret1 +} + +// ListTypeVersionsRequest indicates an expected call of ListTypeVersionsRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeVersionsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeVersionsRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeVersionsRequest), arg0) +} + +// ListTypeVersionsWithContext mocks base method. +func (m *MockCloudFormationAPI) ListTypeVersionsWithContext(arg0 aws.Context, arg1 *cloudformation.ListTypeVersionsInput, arg2 ...request.Option) (*cloudformation.ListTypeVersionsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListTypeVersionsWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListTypeVersionsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypeVersionsWithContext indicates an expected call of ListTypeVersionsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListTypeVersionsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypeVersionsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypeVersionsWithContext), varargs...) +} + +// ListTypes mocks base method. +func (m *MockCloudFormationAPI) ListTypes(arg0 *cloudformation.ListTypesInput) (*cloudformation.ListTypesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypes", arg0) + ret0, _ := ret[0].(*cloudformation.ListTypesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypes indicates an expected call of ListTypes. +func (mr *MockCloudFormationAPIMockRecorder) ListTypes(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypes", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypes), arg0) +} + +// ListTypesPages mocks base method. +func (m *MockCloudFormationAPI) ListTypesPages(arg0 *cloudformation.ListTypesInput, arg1 func(*cloudformation.ListTypesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListTypesPages indicates an expected call of ListTypesPages. +func (mr *MockCloudFormationAPIMockRecorder) ListTypesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypesPages", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypesPages), arg0, arg1) +} + +// ListTypesPagesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListTypesPagesWithContext(arg0 aws.Context, arg1 *cloudformation.ListTypesInput, arg2 func(*cloudformation.ListTypesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListTypesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListTypesPagesWithContext indicates an expected call of ListTypesPagesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListTypesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypesPagesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypesPagesWithContext), varargs...) +} + +// ListTypesRequest mocks base method. +func (m *MockCloudFormationAPI) ListTypesRequest(arg0 *cloudformation.ListTypesInput) (*request.Request, *cloudformation.ListTypesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListTypesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ListTypesOutput) + return ret0, ret1 +} + +// ListTypesRequest indicates an expected call of ListTypesRequest. +func (mr *MockCloudFormationAPIMockRecorder) ListTypesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypesRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypesRequest), arg0) +} + +// ListTypesWithContext mocks base method. +func (m *MockCloudFormationAPI) ListTypesWithContext(arg0 aws.Context, arg1 *cloudformation.ListTypesInput, arg2 ...request.Option) (*cloudformation.ListTypesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListTypesWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ListTypesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListTypesWithContext indicates an expected call of ListTypesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ListTypesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTypesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ListTypesWithContext), varargs...) +} + +// PublishType mocks base method. +func (m *MockCloudFormationAPI) PublishType(arg0 *cloudformation.PublishTypeInput) (*cloudformation.PublishTypeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PublishType", arg0) + ret0, _ := ret[0].(*cloudformation.PublishTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PublishType indicates an expected call of PublishType. +func (mr *MockCloudFormationAPIMockRecorder) PublishType(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishType", reflect.TypeOf((*MockCloudFormationAPI)(nil).PublishType), arg0) +} + +// PublishTypeRequest mocks base method. +func (m *MockCloudFormationAPI) PublishTypeRequest(arg0 *cloudformation.PublishTypeInput) (*request.Request, *cloudformation.PublishTypeOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PublishTypeRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.PublishTypeOutput) + return ret0, ret1 +} + +// PublishTypeRequest indicates an expected call of PublishTypeRequest. +func (mr *MockCloudFormationAPIMockRecorder) PublishTypeRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishTypeRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).PublishTypeRequest), arg0) +} + +// PublishTypeWithContext mocks base method. +func (m *MockCloudFormationAPI) PublishTypeWithContext(arg0 aws.Context, arg1 *cloudformation.PublishTypeInput, arg2 ...request.Option) (*cloudformation.PublishTypeOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PublishTypeWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.PublishTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PublishTypeWithContext indicates an expected call of PublishTypeWithContext. +func (mr *MockCloudFormationAPIMockRecorder) PublishTypeWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PublishTypeWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).PublishTypeWithContext), varargs...) +} + +// RecordHandlerProgress mocks base method. +func (m *MockCloudFormationAPI) RecordHandlerProgress(arg0 *cloudformation.RecordHandlerProgressInput) (*cloudformation.RecordHandlerProgressOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecordHandlerProgress", arg0) + ret0, _ := ret[0].(*cloudformation.RecordHandlerProgressOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RecordHandlerProgress indicates an expected call of RecordHandlerProgress. +func (mr *MockCloudFormationAPIMockRecorder) RecordHandlerProgress(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordHandlerProgress", reflect.TypeOf((*MockCloudFormationAPI)(nil).RecordHandlerProgress), arg0) +} + +// RecordHandlerProgressRequest mocks base method. +func (m *MockCloudFormationAPI) RecordHandlerProgressRequest(arg0 *cloudformation.RecordHandlerProgressInput) (*request.Request, *cloudformation.RecordHandlerProgressOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecordHandlerProgressRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.RecordHandlerProgressOutput) + return ret0, ret1 +} + +// RecordHandlerProgressRequest indicates an expected call of RecordHandlerProgressRequest. +func (mr *MockCloudFormationAPIMockRecorder) RecordHandlerProgressRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordHandlerProgressRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).RecordHandlerProgressRequest), arg0) +} + +// RecordHandlerProgressWithContext mocks base method. +func (m *MockCloudFormationAPI) RecordHandlerProgressWithContext(arg0 aws.Context, arg1 *cloudformation.RecordHandlerProgressInput, arg2 ...request.Option) (*cloudformation.RecordHandlerProgressOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RecordHandlerProgressWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.RecordHandlerProgressOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RecordHandlerProgressWithContext indicates an expected call of RecordHandlerProgressWithContext. +func (mr *MockCloudFormationAPIMockRecorder) RecordHandlerProgressWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordHandlerProgressWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).RecordHandlerProgressWithContext), varargs...) +} + +// RegisterPublisher mocks base method. +func (m *MockCloudFormationAPI) RegisterPublisher(arg0 *cloudformation.RegisterPublisherInput) (*cloudformation.RegisterPublisherOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterPublisher", arg0) + ret0, _ := ret[0].(*cloudformation.RegisterPublisherOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RegisterPublisher indicates an expected call of RegisterPublisher. +func (mr *MockCloudFormationAPIMockRecorder) RegisterPublisher(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterPublisher", reflect.TypeOf((*MockCloudFormationAPI)(nil).RegisterPublisher), arg0) +} + +// RegisterPublisherRequest mocks base method. +func (m *MockCloudFormationAPI) RegisterPublisherRequest(arg0 *cloudformation.RegisterPublisherInput) (*request.Request, *cloudformation.RegisterPublisherOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterPublisherRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.RegisterPublisherOutput) + return ret0, ret1 +} + +// RegisterPublisherRequest indicates an expected call of RegisterPublisherRequest. +func (mr *MockCloudFormationAPIMockRecorder) RegisterPublisherRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterPublisherRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).RegisterPublisherRequest), arg0) +} + +// RegisterPublisherWithContext mocks base method. +func (m *MockCloudFormationAPI) RegisterPublisherWithContext(arg0 aws.Context, arg1 *cloudformation.RegisterPublisherInput, arg2 ...request.Option) (*cloudformation.RegisterPublisherOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RegisterPublisherWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.RegisterPublisherOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RegisterPublisherWithContext indicates an expected call of RegisterPublisherWithContext. +func (mr *MockCloudFormationAPIMockRecorder) RegisterPublisherWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterPublisherWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).RegisterPublisherWithContext), varargs...) +} + +// RegisterType mocks base method. +func (m *MockCloudFormationAPI) RegisterType(arg0 *cloudformation.RegisterTypeInput) (*cloudformation.RegisterTypeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterType", arg0) + ret0, _ := ret[0].(*cloudformation.RegisterTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RegisterType indicates an expected call of RegisterType. +func (mr *MockCloudFormationAPIMockRecorder) RegisterType(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterType", reflect.TypeOf((*MockCloudFormationAPI)(nil).RegisterType), arg0) +} + +// RegisterTypeRequest mocks base method. +func (m *MockCloudFormationAPI) RegisterTypeRequest(arg0 *cloudformation.RegisterTypeInput) (*request.Request, *cloudformation.RegisterTypeOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterTypeRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.RegisterTypeOutput) + return ret0, ret1 +} + +// RegisterTypeRequest indicates an expected call of RegisterTypeRequest. +func (mr *MockCloudFormationAPIMockRecorder) RegisterTypeRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterTypeRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).RegisterTypeRequest), arg0) +} + +// RegisterTypeWithContext mocks base method. +func (m *MockCloudFormationAPI) RegisterTypeWithContext(arg0 aws.Context, arg1 *cloudformation.RegisterTypeInput, arg2 ...request.Option) (*cloudformation.RegisterTypeOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RegisterTypeWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.RegisterTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RegisterTypeWithContext indicates an expected call of RegisterTypeWithContext. +func (mr *MockCloudFormationAPIMockRecorder) RegisterTypeWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterTypeWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).RegisterTypeWithContext), varargs...) +} + +// RollbackStack mocks base method. +func (m *MockCloudFormationAPI) RollbackStack(arg0 *cloudformation.RollbackStackInput) (*cloudformation.RollbackStackOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RollbackStack", arg0) + ret0, _ := ret[0].(*cloudformation.RollbackStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RollbackStack indicates an expected call of RollbackStack. +func (mr *MockCloudFormationAPIMockRecorder) RollbackStack(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackStack", reflect.TypeOf((*MockCloudFormationAPI)(nil).RollbackStack), arg0) +} + +// RollbackStackRequest mocks base method. +func (m *MockCloudFormationAPI) RollbackStackRequest(arg0 *cloudformation.RollbackStackInput) (*request.Request, *cloudformation.RollbackStackOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RollbackStackRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.RollbackStackOutput) + return ret0, ret1 +} + +// RollbackStackRequest indicates an expected call of RollbackStackRequest. +func (mr *MockCloudFormationAPIMockRecorder) RollbackStackRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackStackRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).RollbackStackRequest), arg0) +} + +// RollbackStackWithContext mocks base method. +func (m *MockCloudFormationAPI) RollbackStackWithContext(arg0 aws.Context, arg1 *cloudformation.RollbackStackInput, arg2 ...request.Option) (*cloudformation.RollbackStackOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RollbackStackWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.RollbackStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RollbackStackWithContext indicates an expected call of RollbackStackWithContext. +func (mr *MockCloudFormationAPIMockRecorder) RollbackStackWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RollbackStackWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).RollbackStackWithContext), varargs...) +} + +// SetStackPolicy mocks base method. +func (m *MockCloudFormationAPI) SetStackPolicy(arg0 *cloudformation.SetStackPolicyInput) (*cloudformation.SetStackPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetStackPolicy", arg0) + ret0, _ := ret[0].(*cloudformation.SetStackPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetStackPolicy indicates an expected call of SetStackPolicy. +func (mr *MockCloudFormationAPIMockRecorder) SetStackPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStackPolicy", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetStackPolicy), arg0) +} + +// SetStackPolicyRequest mocks base method. +func (m *MockCloudFormationAPI) SetStackPolicyRequest(arg0 *cloudformation.SetStackPolicyInput) (*request.Request, *cloudformation.SetStackPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetStackPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.SetStackPolicyOutput) + return ret0, ret1 +} + +// SetStackPolicyRequest indicates an expected call of SetStackPolicyRequest. +func (mr *MockCloudFormationAPIMockRecorder) SetStackPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStackPolicyRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetStackPolicyRequest), arg0) +} + +// SetStackPolicyWithContext mocks base method. +func (m *MockCloudFormationAPI) SetStackPolicyWithContext(arg0 aws.Context, arg1 *cloudformation.SetStackPolicyInput, arg2 ...request.Option) (*cloudformation.SetStackPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SetStackPolicyWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.SetStackPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetStackPolicyWithContext indicates an expected call of SetStackPolicyWithContext. +func (mr *MockCloudFormationAPIMockRecorder) SetStackPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetStackPolicyWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetStackPolicyWithContext), varargs...) +} + +// SetTypeConfiguration mocks base method. +func (m *MockCloudFormationAPI) SetTypeConfiguration(arg0 *cloudformation.SetTypeConfigurationInput) (*cloudformation.SetTypeConfigurationOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetTypeConfiguration", arg0) + ret0, _ := ret[0].(*cloudformation.SetTypeConfigurationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetTypeConfiguration indicates an expected call of SetTypeConfiguration. +func (mr *MockCloudFormationAPIMockRecorder) SetTypeConfiguration(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTypeConfiguration", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetTypeConfiguration), arg0) +} + +// SetTypeConfigurationRequest mocks base method. +func (m *MockCloudFormationAPI) SetTypeConfigurationRequest(arg0 *cloudformation.SetTypeConfigurationInput) (*request.Request, *cloudformation.SetTypeConfigurationOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetTypeConfigurationRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.SetTypeConfigurationOutput) + return ret0, ret1 +} + +// SetTypeConfigurationRequest indicates an expected call of SetTypeConfigurationRequest. +func (mr *MockCloudFormationAPIMockRecorder) SetTypeConfigurationRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTypeConfigurationRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetTypeConfigurationRequest), arg0) +} + +// SetTypeConfigurationWithContext mocks base method. +func (m *MockCloudFormationAPI) SetTypeConfigurationWithContext(arg0 aws.Context, arg1 *cloudformation.SetTypeConfigurationInput, arg2 ...request.Option) (*cloudformation.SetTypeConfigurationOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SetTypeConfigurationWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.SetTypeConfigurationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetTypeConfigurationWithContext indicates an expected call of SetTypeConfigurationWithContext. +func (mr *MockCloudFormationAPIMockRecorder) SetTypeConfigurationWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTypeConfigurationWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetTypeConfigurationWithContext), varargs...) +} + +// SetTypeDefaultVersion mocks base method. +func (m *MockCloudFormationAPI) SetTypeDefaultVersion(arg0 *cloudformation.SetTypeDefaultVersionInput) (*cloudformation.SetTypeDefaultVersionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetTypeDefaultVersion", arg0) + ret0, _ := ret[0].(*cloudformation.SetTypeDefaultVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetTypeDefaultVersion indicates an expected call of SetTypeDefaultVersion. +func (mr *MockCloudFormationAPIMockRecorder) SetTypeDefaultVersion(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTypeDefaultVersion", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetTypeDefaultVersion), arg0) +} + +// SetTypeDefaultVersionRequest mocks base method. +func (m *MockCloudFormationAPI) SetTypeDefaultVersionRequest(arg0 *cloudformation.SetTypeDefaultVersionInput) (*request.Request, *cloudformation.SetTypeDefaultVersionOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetTypeDefaultVersionRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.SetTypeDefaultVersionOutput) + return ret0, ret1 +} + +// SetTypeDefaultVersionRequest indicates an expected call of SetTypeDefaultVersionRequest. +func (mr *MockCloudFormationAPIMockRecorder) SetTypeDefaultVersionRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTypeDefaultVersionRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetTypeDefaultVersionRequest), arg0) +} + +// SetTypeDefaultVersionWithContext mocks base method. +func (m *MockCloudFormationAPI) SetTypeDefaultVersionWithContext(arg0 aws.Context, arg1 *cloudformation.SetTypeDefaultVersionInput, arg2 ...request.Option) (*cloudformation.SetTypeDefaultVersionOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SetTypeDefaultVersionWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.SetTypeDefaultVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetTypeDefaultVersionWithContext indicates an expected call of SetTypeDefaultVersionWithContext. +func (mr *MockCloudFormationAPIMockRecorder) SetTypeDefaultVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTypeDefaultVersionWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).SetTypeDefaultVersionWithContext), varargs...) +} + +// SignalResource mocks base method. +func (m *MockCloudFormationAPI) SignalResource(arg0 *cloudformation.SignalResourceInput) (*cloudformation.SignalResourceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SignalResource", arg0) + ret0, _ := ret[0].(*cloudformation.SignalResourceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SignalResource indicates an expected call of SignalResource. +func (mr *MockCloudFormationAPIMockRecorder) SignalResource(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignalResource", reflect.TypeOf((*MockCloudFormationAPI)(nil).SignalResource), arg0) +} + +// SignalResourceRequest mocks base method. +func (m *MockCloudFormationAPI) SignalResourceRequest(arg0 *cloudformation.SignalResourceInput) (*request.Request, *cloudformation.SignalResourceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SignalResourceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.SignalResourceOutput) + return ret0, ret1 +} + +// SignalResourceRequest indicates an expected call of SignalResourceRequest. +func (mr *MockCloudFormationAPIMockRecorder) SignalResourceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignalResourceRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).SignalResourceRequest), arg0) +} + +// SignalResourceWithContext mocks base method. +func (m *MockCloudFormationAPI) SignalResourceWithContext(arg0 aws.Context, arg1 *cloudformation.SignalResourceInput, arg2 ...request.Option) (*cloudformation.SignalResourceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SignalResourceWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.SignalResourceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SignalResourceWithContext indicates an expected call of SignalResourceWithContext. +func (mr *MockCloudFormationAPIMockRecorder) SignalResourceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignalResourceWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).SignalResourceWithContext), varargs...) +} + +// StopStackSetOperation mocks base method. +func (m *MockCloudFormationAPI) StopStackSetOperation(arg0 *cloudformation.StopStackSetOperationInput) (*cloudformation.StopStackSetOperationOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StopStackSetOperation", arg0) + ret0, _ := ret[0].(*cloudformation.StopStackSetOperationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StopStackSetOperation indicates an expected call of StopStackSetOperation. +func (mr *MockCloudFormationAPIMockRecorder) StopStackSetOperation(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopStackSetOperation", reflect.TypeOf((*MockCloudFormationAPI)(nil).StopStackSetOperation), arg0) +} + +// StopStackSetOperationRequest mocks base method. +func (m *MockCloudFormationAPI) StopStackSetOperationRequest(arg0 *cloudformation.StopStackSetOperationInput) (*request.Request, *cloudformation.StopStackSetOperationOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StopStackSetOperationRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.StopStackSetOperationOutput) + return ret0, ret1 +} + +// StopStackSetOperationRequest indicates an expected call of StopStackSetOperationRequest. +func (mr *MockCloudFormationAPIMockRecorder) StopStackSetOperationRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopStackSetOperationRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).StopStackSetOperationRequest), arg0) +} + +// StopStackSetOperationWithContext mocks base method. +func (m *MockCloudFormationAPI) StopStackSetOperationWithContext(arg0 aws.Context, arg1 *cloudformation.StopStackSetOperationInput, arg2 ...request.Option) (*cloudformation.StopStackSetOperationOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StopStackSetOperationWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.StopStackSetOperationOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StopStackSetOperationWithContext indicates an expected call of StopStackSetOperationWithContext. +func (mr *MockCloudFormationAPIMockRecorder) StopStackSetOperationWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StopStackSetOperationWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).StopStackSetOperationWithContext), varargs...) +} + +// TestType mocks base method. +func (m *MockCloudFormationAPI) TestType(arg0 *cloudformation.TestTypeInput) (*cloudformation.TestTypeOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TestType", arg0) + ret0, _ := ret[0].(*cloudformation.TestTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TestType indicates an expected call of TestType. +func (mr *MockCloudFormationAPIMockRecorder) TestType(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TestType", reflect.TypeOf((*MockCloudFormationAPI)(nil).TestType), arg0) +} + +// TestTypeRequest mocks base method. +func (m *MockCloudFormationAPI) TestTypeRequest(arg0 *cloudformation.TestTypeInput) (*request.Request, *cloudformation.TestTypeOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TestTypeRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.TestTypeOutput) + return ret0, ret1 +} + +// TestTypeRequest indicates an expected call of TestTypeRequest. +func (mr *MockCloudFormationAPIMockRecorder) TestTypeRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TestTypeRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).TestTypeRequest), arg0) +} + +// TestTypeWithContext mocks base method. +func (m *MockCloudFormationAPI) TestTypeWithContext(arg0 aws.Context, arg1 *cloudformation.TestTypeInput, arg2 ...request.Option) (*cloudformation.TestTypeOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TestTypeWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.TestTypeOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TestTypeWithContext indicates an expected call of TestTypeWithContext. +func (mr *MockCloudFormationAPIMockRecorder) TestTypeWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TestTypeWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).TestTypeWithContext), varargs...) +} + +// UpdateStack mocks base method. +func (m *MockCloudFormationAPI) UpdateStack(arg0 *cloudformation.UpdateStackInput) (*cloudformation.UpdateStackOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateStack", arg0) + ret0, _ := ret[0].(*cloudformation.UpdateStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateStack indicates an expected call of UpdateStack. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStack(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStack", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStack), arg0) +} + +// UpdateStackInstances mocks base method. +func (m *MockCloudFormationAPI) UpdateStackInstances(arg0 *cloudformation.UpdateStackInstancesInput) (*cloudformation.UpdateStackInstancesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateStackInstances", arg0) + ret0, _ := ret[0].(*cloudformation.UpdateStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateStackInstances indicates an expected call of UpdateStackInstances. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackInstances(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackInstances", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackInstances), arg0) +} + +// UpdateStackInstancesRequest mocks base method. +func (m *MockCloudFormationAPI) UpdateStackInstancesRequest(arg0 *cloudformation.UpdateStackInstancesInput) (*request.Request, *cloudformation.UpdateStackInstancesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateStackInstancesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.UpdateStackInstancesOutput) + return ret0, ret1 +} + +// UpdateStackInstancesRequest indicates an expected call of UpdateStackInstancesRequest. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackInstancesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackInstancesRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackInstancesRequest), arg0) +} + +// UpdateStackInstancesWithContext mocks base method. +func (m *MockCloudFormationAPI) UpdateStackInstancesWithContext(arg0 aws.Context, arg1 *cloudformation.UpdateStackInstancesInput, arg2 ...request.Option) (*cloudformation.UpdateStackInstancesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateStackInstancesWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.UpdateStackInstancesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateStackInstancesWithContext indicates an expected call of UpdateStackInstancesWithContext. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackInstancesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackInstancesWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackInstancesWithContext), varargs...) +} + +// UpdateStackRequest mocks base method. +func (m *MockCloudFormationAPI) UpdateStackRequest(arg0 *cloudformation.UpdateStackInput) (*request.Request, *cloudformation.UpdateStackOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateStackRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.UpdateStackOutput) + return ret0, ret1 +} + +// UpdateStackRequest indicates an expected call of UpdateStackRequest. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackRequest), arg0) +} + +// UpdateStackSet mocks base method. +func (m *MockCloudFormationAPI) UpdateStackSet(arg0 *cloudformation.UpdateStackSetInput) (*cloudformation.UpdateStackSetOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateStackSet", arg0) + ret0, _ := ret[0].(*cloudformation.UpdateStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateStackSet indicates an expected call of UpdateStackSet. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackSet(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackSet", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackSet), arg0) +} + +// UpdateStackSetRequest mocks base method. +func (m *MockCloudFormationAPI) UpdateStackSetRequest(arg0 *cloudformation.UpdateStackSetInput) (*request.Request, *cloudformation.UpdateStackSetOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateStackSetRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.UpdateStackSetOutput) + return ret0, ret1 +} + +// UpdateStackSetRequest indicates an expected call of UpdateStackSetRequest. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackSetRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackSetRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackSetRequest), arg0) +} + +// UpdateStackSetWithContext mocks base method. +func (m *MockCloudFormationAPI) UpdateStackSetWithContext(arg0 aws.Context, arg1 *cloudformation.UpdateStackSetInput, arg2 ...request.Option) (*cloudformation.UpdateStackSetOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateStackSetWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.UpdateStackSetOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateStackSetWithContext indicates an expected call of UpdateStackSetWithContext. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackSetWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackSetWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackSetWithContext), varargs...) +} + +// UpdateStackWithContext mocks base method. +func (m *MockCloudFormationAPI) UpdateStackWithContext(arg0 aws.Context, arg1 *cloudformation.UpdateStackInput, arg2 ...request.Option) (*cloudformation.UpdateStackOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateStackWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.UpdateStackOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateStackWithContext indicates an expected call of UpdateStackWithContext. +func (mr *MockCloudFormationAPIMockRecorder) UpdateStackWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateStackWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateStackWithContext), varargs...) +} + +// UpdateTerminationProtection mocks base method. +func (m *MockCloudFormationAPI) UpdateTerminationProtection(arg0 *cloudformation.UpdateTerminationProtectionInput) (*cloudformation.UpdateTerminationProtectionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateTerminationProtection", arg0) + ret0, _ := ret[0].(*cloudformation.UpdateTerminationProtectionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateTerminationProtection indicates an expected call of UpdateTerminationProtection. +func (mr *MockCloudFormationAPIMockRecorder) UpdateTerminationProtection(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTerminationProtection", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateTerminationProtection), arg0) +} + +// UpdateTerminationProtectionRequest mocks base method. +func (m *MockCloudFormationAPI) UpdateTerminationProtectionRequest(arg0 *cloudformation.UpdateTerminationProtectionInput) (*request.Request, *cloudformation.UpdateTerminationProtectionOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateTerminationProtectionRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.UpdateTerminationProtectionOutput) + return ret0, ret1 +} + +// UpdateTerminationProtectionRequest indicates an expected call of UpdateTerminationProtectionRequest. +func (mr *MockCloudFormationAPIMockRecorder) UpdateTerminationProtectionRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTerminationProtectionRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateTerminationProtectionRequest), arg0) +} + +// UpdateTerminationProtectionWithContext mocks base method. +func (m *MockCloudFormationAPI) UpdateTerminationProtectionWithContext(arg0 aws.Context, arg1 *cloudformation.UpdateTerminationProtectionInput, arg2 ...request.Option) (*cloudformation.UpdateTerminationProtectionOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateTerminationProtectionWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.UpdateTerminationProtectionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateTerminationProtectionWithContext indicates an expected call of UpdateTerminationProtectionWithContext. +func (mr *MockCloudFormationAPIMockRecorder) UpdateTerminationProtectionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTerminationProtectionWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).UpdateTerminationProtectionWithContext), varargs...) +} + +// ValidateTemplate mocks base method. +func (m *MockCloudFormationAPI) ValidateTemplate(arg0 *cloudformation.ValidateTemplateInput) (*cloudformation.ValidateTemplateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidateTemplate", arg0) + ret0, _ := ret[0].(*cloudformation.ValidateTemplateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidateTemplate indicates an expected call of ValidateTemplate. +func (mr *MockCloudFormationAPIMockRecorder) ValidateTemplate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateTemplate", reflect.TypeOf((*MockCloudFormationAPI)(nil).ValidateTemplate), arg0) +} + +// ValidateTemplateRequest mocks base method. +func (m *MockCloudFormationAPI) ValidateTemplateRequest(arg0 *cloudformation.ValidateTemplateInput) (*request.Request, *cloudformation.ValidateTemplateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidateTemplateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*cloudformation.ValidateTemplateOutput) + return ret0, ret1 +} + +// ValidateTemplateRequest indicates an expected call of ValidateTemplateRequest. +func (mr *MockCloudFormationAPIMockRecorder) ValidateTemplateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateTemplateRequest", reflect.TypeOf((*MockCloudFormationAPI)(nil).ValidateTemplateRequest), arg0) +} + +// ValidateTemplateWithContext mocks base method. +func (m *MockCloudFormationAPI) ValidateTemplateWithContext(arg0 aws.Context, arg1 *cloudformation.ValidateTemplateInput, arg2 ...request.Option) (*cloudformation.ValidateTemplateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ValidateTemplateWithContext", varargs...) + ret0, _ := ret[0].(*cloudformation.ValidateTemplateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidateTemplateWithContext indicates an expected call of ValidateTemplateWithContext. +func (mr *MockCloudFormationAPIMockRecorder) ValidateTemplateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateTemplateWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).ValidateTemplateWithContext), varargs...) +} + +// WaitUntilChangeSetCreateComplete mocks base method. +func (m *MockCloudFormationAPI) WaitUntilChangeSetCreateComplete(arg0 *cloudformation.DescribeChangeSetInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilChangeSetCreateComplete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilChangeSetCreateComplete indicates an expected call of WaitUntilChangeSetCreateComplete. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilChangeSetCreateComplete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilChangeSetCreateComplete", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilChangeSetCreateComplete), arg0) +} + +// WaitUntilChangeSetCreateCompleteWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilChangeSetCreateCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeChangeSetInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilChangeSetCreateCompleteWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilChangeSetCreateCompleteWithContext indicates an expected call of WaitUntilChangeSetCreateCompleteWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilChangeSetCreateCompleteWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilChangeSetCreateCompleteWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilChangeSetCreateCompleteWithContext), varargs...) +} + +// WaitUntilStackCreateComplete mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackCreateComplete(arg0 *cloudformation.DescribeStacksInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilStackCreateComplete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackCreateComplete indicates an expected call of WaitUntilStackCreateComplete. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackCreateComplete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackCreateComplete", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackCreateComplete), arg0) +} + +// WaitUntilStackCreateCompleteWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackCreateCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilStackCreateCompleteWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackCreateCompleteWithContext indicates an expected call of WaitUntilStackCreateCompleteWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackCreateCompleteWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackCreateCompleteWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackCreateCompleteWithContext), varargs...) +} + +// WaitUntilStackDeleteComplete mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackDeleteComplete(arg0 *cloudformation.DescribeStacksInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilStackDeleteComplete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackDeleteComplete indicates an expected call of WaitUntilStackDeleteComplete. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackDeleteComplete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackDeleteComplete", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackDeleteComplete), arg0) +} + +// WaitUntilStackDeleteCompleteWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackDeleteCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilStackDeleteCompleteWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackDeleteCompleteWithContext indicates an expected call of WaitUntilStackDeleteCompleteWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackDeleteCompleteWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackDeleteCompleteWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackDeleteCompleteWithContext), varargs...) +} + +// WaitUntilStackExists mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackExists(arg0 *cloudformation.DescribeStacksInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilStackExists", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackExists indicates an expected call of WaitUntilStackExists. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackExists(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackExists", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackExists), arg0) +} + +// WaitUntilStackExistsWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackExistsWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilStackExistsWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackExistsWithContext indicates an expected call of WaitUntilStackExistsWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackExistsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackExistsWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackExistsWithContext), varargs...) +} + +// WaitUntilStackImportComplete mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackImportComplete(arg0 *cloudformation.DescribeStacksInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilStackImportComplete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackImportComplete indicates an expected call of WaitUntilStackImportComplete. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackImportComplete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackImportComplete", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackImportComplete), arg0) +} + +// WaitUntilStackImportCompleteWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackImportCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilStackImportCompleteWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackImportCompleteWithContext indicates an expected call of WaitUntilStackImportCompleteWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackImportCompleteWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackImportCompleteWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackImportCompleteWithContext), varargs...) +} + +// WaitUntilStackRollbackComplete mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackRollbackComplete(arg0 *cloudformation.DescribeStacksInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilStackRollbackComplete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackRollbackComplete indicates an expected call of WaitUntilStackRollbackComplete. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackRollbackComplete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackRollbackComplete", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackRollbackComplete), arg0) +} + +// WaitUntilStackRollbackCompleteWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackRollbackCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilStackRollbackCompleteWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackRollbackCompleteWithContext indicates an expected call of WaitUntilStackRollbackCompleteWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackRollbackCompleteWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackRollbackCompleteWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackRollbackCompleteWithContext), varargs...) +} + +// WaitUntilStackUpdateComplete mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackUpdateComplete(arg0 *cloudformation.DescribeStacksInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilStackUpdateComplete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackUpdateComplete indicates an expected call of WaitUntilStackUpdateComplete. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackUpdateComplete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackUpdateComplete", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackUpdateComplete), arg0) +} + +// WaitUntilStackUpdateCompleteWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilStackUpdateCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeStacksInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilStackUpdateCompleteWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilStackUpdateCompleteWithContext indicates an expected call of WaitUntilStackUpdateCompleteWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilStackUpdateCompleteWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilStackUpdateCompleteWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilStackUpdateCompleteWithContext), varargs...) +} + +// WaitUntilTypeRegistrationComplete mocks base method. +func (m *MockCloudFormationAPI) WaitUntilTypeRegistrationComplete(arg0 *cloudformation.DescribeTypeRegistrationInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilTypeRegistrationComplete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilTypeRegistrationComplete indicates an expected call of WaitUntilTypeRegistrationComplete. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilTypeRegistrationComplete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilTypeRegistrationComplete", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilTypeRegistrationComplete), arg0) +} + +// WaitUntilTypeRegistrationCompleteWithContext mocks base method. +func (m *MockCloudFormationAPI) WaitUntilTypeRegistrationCompleteWithContext(arg0 aws.Context, arg1 *cloudformation.DescribeTypeRegistrationInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilTypeRegistrationCompleteWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilTypeRegistrationCompleteWithContext indicates an expected call of WaitUntilTypeRegistrationCompleteWithContext. +func (mr *MockCloudFormationAPIMockRecorder) WaitUntilTypeRegistrationCompleteWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilTypeRegistrationCompleteWithContext", reflect.TypeOf((*MockCloudFormationAPI)(nil).WaitUntilTypeRegistrationCompleteWithContext), varargs...) +} diff --git a/mocks/mock_iamiface/mock.go b/mocks/mock_iamiface/mock.go new file mode 100644 index 000000000..566f89344 --- /dev/null +++ b/mocks/mock_iamiface/mock.go @@ -0,0 +1,9045 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: /Users/ekristen/go/pkg/mod/github.com/aws/aws-sdk-go@v1.44.225/service/iam/iamiface/interface.go + +// Package mock_iamiface is a generated GoMock package. +package mock_iamiface + +import ( + reflect "reflect" + + aws "github.com/aws/aws-sdk-go/aws" + request "github.com/aws/aws-sdk-go/aws/request" + iam "github.com/aws/aws-sdk-go/service/iam" + gomock "github.com/golang/mock/gomock" +) + +// MockIAMAPI is a mock of IAMAPI interface. +type MockIAMAPI struct { + ctrl *gomock.Controller + recorder *MockIAMAPIMockRecorder +} + +func (m *MockIAMAPI) GetMFADevice(input *iam.GetMFADeviceInput) (*iam.GetMFADeviceOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) GetMFADeviceWithContext(context aws.Context, input *iam.GetMFADeviceInput, option ...request.Option) (*iam.GetMFADeviceOutput, error) { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) GetMFADeviceRequest(input *iam.GetMFADeviceInput) (*request.Request, *iam.GetMFADeviceOutput) { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListInstanceProfileTagsPages(input *iam.ListInstanceProfileTagsInput, f func(*iam.ListInstanceProfileTagsOutput, bool) bool) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListInstanceProfileTagsPagesWithContext(context aws.Context, input *iam.ListInstanceProfileTagsInput, f func(*iam.ListInstanceProfileTagsOutput, bool) bool, option ...request.Option) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListMFADeviceTagsPages(input *iam.ListMFADeviceTagsInput, f func(*iam.ListMFADeviceTagsOutput, bool) bool) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListMFADeviceTagsPagesWithContext(context aws.Context, input *iam.ListMFADeviceTagsInput, f func(*iam.ListMFADeviceTagsOutput, bool) bool, option ...request.Option) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListOpenIDConnectProviderTagsPages(input *iam.ListOpenIDConnectProviderTagsInput, f func(*iam.ListOpenIDConnectProviderTagsOutput, bool) bool) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListOpenIDConnectProviderTagsPagesWithContext(context aws.Context, input *iam.ListOpenIDConnectProviderTagsInput, f func(*iam.ListOpenIDConnectProviderTagsOutput, bool) bool, option ...request.Option) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListPolicyTagsPages(input *iam.ListPolicyTagsInput, f func(*iam.ListPolicyTagsOutput, bool) bool) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListPolicyTagsPagesWithContext(context aws.Context, input *iam.ListPolicyTagsInput, f func(*iam.ListPolicyTagsOutput, bool) bool, option ...request.Option) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListRoleTagsPages(input *iam.ListRoleTagsInput, f func(*iam.ListRoleTagsOutput, bool) bool) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListRoleTagsPagesWithContext(context aws.Context, input *iam.ListRoleTagsInput, f func(*iam.ListRoleTagsOutput, bool) bool, option ...request.Option) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListSAMLProviderTagsPages(input *iam.ListSAMLProviderTagsInput, f func(*iam.ListSAMLProviderTagsOutput, bool) bool) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListSAMLProviderTagsPagesWithContext(context aws.Context, input *iam.ListSAMLProviderTagsInput, f func(*iam.ListSAMLProviderTagsOutput, bool) bool, option ...request.Option) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListServerCertificateTagsPages(input *iam.ListServerCertificateTagsInput, f func(*iam.ListServerCertificateTagsOutput, bool) bool) error { + //TODO implement me + panic("implement me") +} + +func (m *MockIAMAPI) ListServerCertificateTagsPagesWithContext(context aws.Context, input *iam.ListServerCertificateTagsInput, f func(*iam.ListServerCertificateTagsOutput, bool) bool, option ...request.Option) error { + //TODO implement me + panic("implement me") +} + +// MockIAMAPIMockRecorder is the mock recorder for MockIAMAPI. +type MockIAMAPIMockRecorder struct { + mock *MockIAMAPI +} + +// NewMockIAMAPI creates a new mock instance. +func NewMockIAMAPI(ctrl *gomock.Controller) *MockIAMAPI { + mock := &MockIAMAPI{ctrl: ctrl} + mock.recorder = &MockIAMAPIMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockIAMAPI) EXPECT() *MockIAMAPIMockRecorder { + return m.recorder +} + +// AddClientIDToOpenIDConnectProvider mocks base method. +func (m *MockIAMAPI) AddClientIDToOpenIDConnectProvider(arg0 *iam.AddClientIDToOpenIDConnectProviderInput) (*iam.AddClientIDToOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddClientIDToOpenIDConnectProvider", arg0) + ret0, _ := ret[0].(*iam.AddClientIDToOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddClientIDToOpenIDConnectProvider indicates an expected call of AddClientIDToOpenIDConnectProvider. +func (mr *MockIAMAPIMockRecorder) AddClientIDToOpenIDConnectProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddClientIDToOpenIDConnectProvider", reflect.TypeOf((*MockIAMAPI)(nil).AddClientIDToOpenIDConnectProvider), arg0) +} + +// AddClientIDToOpenIDConnectProviderRequest mocks base method. +func (m *MockIAMAPI) AddClientIDToOpenIDConnectProviderRequest(arg0 *iam.AddClientIDToOpenIDConnectProviderInput) (*request.Request, *iam.AddClientIDToOpenIDConnectProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddClientIDToOpenIDConnectProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.AddClientIDToOpenIDConnectProviderOutput) + return ret0, ret1 +} + +// AddClientIDToOpenIDConnectProviderRequest indicates an expected call of AddClientIDToOpenIDConnectProviderRequest. +func (mr *MockIAMAPIMockRecorder) AddClientIDToOpenIDConnectProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddClientIDToOpenIDConnectProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).AddClientIDToOpenIDConnectProviderRequest), arg0) +} + +// AddClientIDToOpenIDConnectProviderWithContext mocks base method. +func (m *MockIAMAPI) AddClientIDToOpenIDConnectProviderWithContext(arg0 aws.Context, arg1 *iam.AddClientIDToOpenIDConnectProviderInput, arg2 ...request.Option) (*iam.AddClientIDToOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AddClientIDToOpenIDConnectProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.AddClientIDToOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddClientIDToOpenIDConnectProviderWithContext indicates an expected call of AddClientIDToOpenIDConnectProviderWithContext. +func (mr *MockIAMAPIMockRecorder) AddClientIDToOpenIDConnectProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddClientIDToOpenIDConnectProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).AddClientIDToOpenIDConnectProviderWithContext), varargs...) +} + +// AddRoleToInstanceProfile mocks base method. +func (m *MockIAMAPI) AddRoleToInstanceProfile(arg0 *iam.AddRoleToInstanceProfileInput) (*iam.AddRoleToInstanceProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddRoleToInstanceProfile", arg0) + ret0, _ := ret[0].(*iam.AddRoleToInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddRoleToInstanceProfile indicates an expected call of AddRoleToInstanceProfile. +func (mr *MockIAMAPIMockRecorder) AddRoleToInstanceProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRoleToInstanceProfile", reflect.TypeOf((*MockIAMAPI)(nil).AddRoleToInstanceProfile), arg0) +} + +// AddRoleToInstanceProfileRequest mocks base method. +func (m *MockIAMAPI) AddRoleToInstanceProfileRequest(arg0 *iam.AddRoleToInstanceProfileInput) (*request.Request, *iam.AddRoleToInstanceProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddRoleToInstanceProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.AddRoleToInstanceProfileOutput) + return ret0, ret1 +} + +// AddRoleToInstanceProfileRequest indicates an expected call of AddRoleToInstanceProfileRequest. +func (mr *MockIAMAPIMockRecorder) AddRoleToInstanceProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRoleToInstanceProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).AddRoleToInstanceProfileRequest), arg0) +} + +// AddRoleToInstanceProfileWithContext mocks base method. +func (m *MockIAMAPI) AddRoleToInstanceProfileWithContext(arg0 aws.Context, arg1 *iam.AddRoleToInstanceProfileInput, arg2 ...request.Option) (*iam.AddRoleToInstanceProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AddRoleToInstanceProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.AddRoleToInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddRoleToInstanceProfileWithContext indicates an expected call of AddRoleToInstanceProfileWithContext. +func (mr *MockIAMAPIMockRecorder) AddRoleToInstanceProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRoleToInstanceProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).AddRoleToInstanceProfileWithContext), varargs...) +} + +// AddUserToGroup mocks base method. +func (m *MockIAMAPI) AddUserToGroup(arg0 *iam.AddUserToGroupInput) (*iam.AddUserToGroupOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddUserToGroup", arg0) + ret0, _ := ret[0].(*iam.AddUserToGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddUserToGroup indicates an expected call of AddUserToGroup. +func (mr *MockIAMAPIMockRecorder) AddUserToGroup(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserToGroup", reflect.TypeOf((*MockIAMAPI)(nil).AddUserToGroup), arg0) +} + +// AddUserToGroupRequest mocks base method. +func (m *MockIAMAPI) AddUserToGroupRequest(arg0 *iam.AddUserToGroupInput) (*request.Request, *iam.AddUserToGroupOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddUserToGroupRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.AddUserToGroupOutput) + return ret0, ret1 +} + +// AddUserToGroupRequest indicates an expected call of AddUserToGroupRequest. +func (mr *MockIAMAPIMockRecorder) AddUserToGroupRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserToGroupRequest", reflect.TypeOf((*MockIAMAPI)(nil).AddUserToGroupRequest), arg0) +} + +// AddUserToGroupWithContext mocks base method. +func (m *MockIAMAPI) AddUserToGroupWithContext(arg0 aws.Context, arg1 *iam.AddUserToGroupInput, arg2 ...request.Option) (*iam.AddUserToGroupOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AddUserToGroupWithContext", varargs...) + ret0, _ := ret[0].(*iam.AddUserToGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddUserToGroupWithContext indicates an expected call of AddUserToGroupWithContext. +func (mr *MockIAMAPIMockRecorder) AddUserToGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserToGroupWithContext", reflect.TypeOf((*MockIAMAPI)(nil).AddUserToGroupWithContext), varargs...) +} + +// AttachGroupPolicy mocks base method. +func (m *MockIAMAPI) AttachGroupPolicy(arg0 *iam.AttachGroupPolicyInput) (*iam.AttachGroupPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AttachGroupPolicy", arg0) + ret0, _ := ret[0].(*iam.AttachGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AttachGroupPolicy indicates an expected call of AttachGroupPolicy. +func (mr *MockIAMAPIMockRecorder) AttachGroupPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachGroupPolicy", reflect.TypeOf((*MockIAMAPI)(nil).AttachGroupPolicy), arg0) +} + +// AttachGroupPolicyRequest mocks base method. +func (m *MockIAMAPI) AttachGroupPolicyRequest(arg0 *iam.AttachGroupPolicyInput) (*request.Request, *iam.AttachGroupPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AttachGroupPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.AttachGroupPolicyOutput) + return ret0, ret1 +} + +// AttachGroupPolicyRequest indicates an expected call of AttachGroupPolicyRequest. +func (mr *MockIAMAPIMockRecorder) AttachGroupPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachGroupPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).AttachGroupPolicyRequest), arg0) +} + +// AttachGroupPolicyWithContext mocks base method. +func (m *MockIAMAPI) AttachGroupPolicyWithContext(arg0 aws.Context, arg1 *iam.AttachGroupPolicyInput, arg2 ...request.Option) (*iam.AttachGroupPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AttachGroupPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.AttachGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AttachGroupPolicyWithContext indicates an expected call of AttachGroupPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) AttachGroupPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachGroupPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).AttachGroupPolicyWithContext), varargs...) +} + +// AttachRolePolicy mocks base method. +func (m *MockIAMAPI) AttachRolePolicy(arg0 *iam.AttachRolePolicyInput) (*iam.AttachRolePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AttachRolePolicy", arg0) + ret0, _ := ret[0].(*iam.AttachRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AttachRolePolicy indicates an expected call of AttachRolePolicy. +func (mr *MockIAMAPIMockRecorder) AttachRolePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachRolePolicy", reflect.TypeOf((*MockIAMAPI)(nil).AttachRolePolicy), arg0) +} + +// AttachRolePolicyRequest mocks base method. +func (m *MockIAMAPI) AttachRolePolicyRequest(arg0 *iam.AttachRolePolicyInput) (*request.Request, *iam.AttachRolePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AttachRolePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.AttachRolePolicyOutput) + return ret0, ret1 +} + +// AttachRolePolicyRequest indicates an expected call of AttachRolePolicyRequest. +func (mr *MockIAMAPIMockRecorder) AttachRolePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachRolePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).AttachRolePolicyRequest), arg0) +} + +// AttachRolePolicyWithContext mocks base method. +func (m *MockIAMAPI) AttachRolePolicyWithContext(arg0 aws.Context, arg1 *iam.AttachRolePolicyInput, arg2 ...request.Option) (*iam.AttachRolePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AttachRolePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.AttachRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AttachRolePolicyWithContext indicates an expected call of AttachRolePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) AttachRolePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachRolePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).AttachRolePolicyWithContext), varargs...) +} + +// AttachUserPolicy mocks base method. +func (m *MockIAMAPI) AttachUserPolicy(arg0 *iam.AttachUserPolicyInput) (*iam.AttachUserPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AttachUserPolicy", arg0) + ret0, _ := ret[0].(*iam.AttachUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AttachUserPolicy indicates an expected call of AttachUserPolicy. +func (mr *MockIAMAPIMockRecorder) AttachUserPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachUserPolicy", reflect.TypeOf((*MockIAMAPI)(nil).AttachUserPolicy), arg0) +} + +// AttachUserPolicyRequest mocks base method. +func (m *MockIAMAPI) AttachUserPolicyRequest(arg0 *iam.AttachUserPolicyInput) (*request.Request, *iam.AttachUserPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AttachUserPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.AttachUserPolicyOutput) + return ret0, ret1 +} + +// AttachUserPolicyRequest indicates an expected call of AttachUserPolicyRequest. +func (mr *MockIAMAPIMockRecorder) AttachUserPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachUserPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).AttachUserPolicyRequest), arg0) +} + +// AttachUserPolicyWithContext mocks base method. +func (m *MockIAMAPI) AttachUserPolicyWithContext(arg0 aws.Context, arg1 *iam.AttachUserPolicyInput, arg2 ...request.Option) (*iam.AttachUserPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AttachUserPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.AttachUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AttachUserPolicyWithContext indicates an expected call of AttachUserPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) AttachUserPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AttachUserPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).AttachUserPolicyWithContext), varargs...) +} + +// ChangePassword mocks base method. +func (m *MockIAMAPI) ChangePassword(arg0 *iam.ChangePasswordInput) (*iam.ChangePasswordOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ChangePassword", arg0) + ret0, _ := ret[0].(*iam.ChangePasswordOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ChangePassword indicates an expected call of ChangePassword. +func (mr *MockIAMAPIMockRecorder) ChangePassword(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChangePassword", reflect.TypeOf((*MockIAMAPI)(nil).ChangePassword), arg0) +} + +// ChangePasswordRequest mocks base method. +func (m *MockIAMAPI) ChangePasswordRequest(arg0 *iam.ChangePasswordInput) (*request.Request, *iam.ChangePasswordOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ChangePasswordRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ChangePasswordOutput) + return ret0, ret1 +} + +// ChangePasswordRequest indicates an expected call of ChangePasswordRequest. +func (mr *MockIAMAPIMockRecorder) ChangePasswordRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChangePasswordRequest", reflect.TypeOf((*MockIAMAPI)(nil).ChangePasswordRequest), arg0) +} + +// ChangePasswordWithContext mocks base method. +func (m *MockIAMAPI) ChangePasswordWithContext(arg0 aws.Context, arg1 *iam.ChangePasswordInput, arg2 ...request.Option) (*iam.ChangePasswordOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ChangePasswordWithContext", varargs...) + ret0, _ := ret[0].(*iam.ChangePasswordOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ChangePasswordWithContext indicates an expected call of ChangePasswordWithContext. +func (mr *MockIAMAPIMockRecorder) ChangePasswordWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChangePasswordWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ChangePasswordWithContext), varargs...) +} + +// CreateAccessKey mocks base method. +func (m *MockIAMAPI) CreateAccessKey(arg0 *iam.CreateAccessKeyInput) (*iam.CreateAccessKeyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateAccessKey", arg0) + ret0, _ := ret[0].(*iam.CreateAccessKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateAccessKey indicates an expected call of CreateAccessKey. +func (mr *MockIAMAPIMockRecorder) CreateAccessKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccessKey", reflect.TypeOf((*MockIAMAPI)(nil).CreateAccessKey), arg0) +} + +// CreateAccessKeyRequest mocks base method. +func (m *MockIAMAPI) CreateAccessKeyRequest(arg0 *iam.CreateAccessKeyInput) (*request.Request, *iam.CreateAccessKeyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateAccessKeyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateAccessKeyOutput) + return ret0, ret1 +} + +// CreateAccessKeyRequest indicates an expected call of CreateAccessKeyRequest. +func (mr *MockIAMAPIMockRecorder) CreateAccessKeyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccessKeyRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateAccessKeyRequest), arg0) +} + +// CreateAccessKeyWithContext mocks base method. +func (m *MockIAMAPI) CreateAccessKeyWithContext(arg0 aws.Context, arg1 *iam.CreateAccessKeyInput, arg2 ...request.Option) (*iam.CreateAccessKeyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateAccessKeyWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateAccessKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateAccessKeyWithContext indicates an expected call of CreateAccessKeyWithContext. +func (mr *MockIAMAPIMockRecorder) CreateAccessKeyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccessKeyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateAccessKeyWithContext), varargs...) +} + +// CreateAccountAlias mocks base method. +func (m *MockIAMAPI) CreateAccountAlias(arg0 *iam.CreateAccountAliasInput) (*iam.CreateAccountAliasOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateAccountAlias", arg0) + ret0, _ := ret[0].(*iam.CreateAccountAliasOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateAccountAlias indicates an expected call of CreateAccountAlias. +func (mr *MockIAMAPIMockRecorder) CreateAccountAlias(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccountAlias", reflect.TypeOf((*MockIAMAPI)(nil).CreateAccountAlias), arg0) +} + +// CreateAccountAliasRequest mocks base method. +func (m *MockIAMAPI) CreateAccountAliasRequest(arg0 *iam.CreateAccountAliasInput) (*request.Request, *iam.CreateAccountAliasOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateAccountAliasRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateAccountAliasOutput) + return ret0, ret1 +} + +// CreateAccountAliasRequest indicates an expected call of CreateAccountAliasRequest. +func (mr *MockIAMAPIMockRecorder) CreateAccountAliasRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccountAliasRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateAccountAliasRequest), arg0) +} + +// CreateAccountAliasWithContext mocks base method. +func (m *MockIAMAPI) CreateAccountAliasWithContext(arg0 aws.Context, arg1 *iam.CreateAccountAliasInput, arg2 ...request.Option) (*iam.CreateAccountAliasOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateAccountAliasWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateAccountAliasOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateAccountAliasWithContext indicates an expected call of CreateAccountAliasWithContext. +func (mr *MockIAMAPIMockRecorder) CreateAccountAliasWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAccountAliasWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateAccountAliasWithContext), varargs...) +} + +// CreateGroup mocks base method. +func (m *MockIAMAPI) CreateGroup(arg0 *iam.CreateGroupInput) (*iam.CreateGroupOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateGroup", arg0) + ret0, _ := ret[0].(*iam.CreateGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateGroup indicates an expected call of CreateGroup. +func (mr *MockIAMAPIMockRecorder) CreateGroup(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGroup", reflect.TypeOf((*MockIAMAPI)(nil).CreateGroup), arg0) +} + +// CreateGroupRequest mocks base method. +func (m *MockIAMAPI) CreateGroupRequest(arg0 *iam.CreateGroupInput) (*request.Request, *iam.CreateGroupOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateGroupRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateGroupOutput) + return ret0, ret1 +} + +// CreateGroupRequest indicates an expected call of CreateGroupRequest. +func (mr *MockIAMAPIMockRecorder) CreateGroupRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGroupRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateGroupRequest), arg0) +} + +// CreateGroupWithContext mocks base method. +func (m *MockIAMAPI) CreateGroupWithContext(arg0 aws.Context, arg1 *iam.CreateGroupInput, arg2 ...request.Option) (*iam.CreateGroupOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateGroupWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateGroupWithContext indicates an expected call of CreateGroupWithContext. +func (mr *MockIAMAPIMockRecorder) CreateGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGroupWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateGroupWithContext), varargs...) +} + +// CreateInstanceProfile mocks base method. +func (m *MockIAMAPI) CreateInstanceProfile(arg0 *iam.CreateInstanceProfileInput) (*iam.CreateInstanceProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateInstanceProfile", arg0) + ret0, _ := ret[0].(*iam.CreateInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateInstanceProfile indicates an expected call of CreateInstanceProfile. +func (mr *MockIAMAPIMockRecorder) CreateInstanceProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateInstanceProfile", reflect.TypeOf((*MockIAMAPI)(nil).CreateInstanceProfile), arg0) +} + +// CreateInstanceProfileRequest mocks base method. +func (m *MockIAMAPI) CreateInstanceProfileRequest(arg0 *iam.CreateInstanceProfileInput) (*request.Request, *iam.CreateInstanceProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateInstanceProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateInstanceProfileOutput) + return ret0, ret1 +} + +// CreateInstanceProfileRequest indicates an expected call of CreateInstanceProfileRequest. +func (mr *MockIAMAPIMockRecorder) CreateInstanceProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateInstanceProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateInstanceProfileRequest), arg0) +} + +// CreateInstanceProfileWithContext mocks base method. +func (m *MockIAMAPI) CreateInstanceProfileWithContext(arg0 aws.Context, arg1 *iam.CreateInstanceProfileInput, arg2 ...request.Option) (*iam.CreateInstanceProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateInstanceProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateInstanceProfileWithContext indicates an expected call of CreateInstanceProfileWithContext. +func (mr *MockIAMAPIMockRecorder) CreateInstanceProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateInstanceProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateInstanceProfileWithContext), varargs...) +} + +// CreateLoginProfile mocks base method. +func (m *MockIAMAPI) CreateLoginProfile(arg0 *iam.CreateLoginProfileInput) (*iam.CreateLoginProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateLoginProfile", arg0) + ret0, _ := ret[0].(*iam.CreateLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateLoginProfile indicates an expected call of CreateLoginProfile. +func (mr *MockIAMAPIMockRecorder) CreateLoginProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoginProfile", reflect.TypeOf((*MockIAMAPI)(nil).CreateLoginProfile), arg0) +} + +// CreateLoginProfileRequest mocks base method. +func (m *MockIAMAPI) CreateLoginProfileRequest(arg0 *iam.CreateLoginProfileInput) (*request.Request, *iam.CreateLoginProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateLoginProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateLoginProfileOutput) + return ret0, ret1 +} + +// CreateLoginProfileRequest indicates an expected call of CreateLoginProfileRequest. +func (mr *MockIAMAPIMockRecorder) CreateLoginProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoginProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateLoginProfileRequest), arg0) +} + +// CreateLoginProfileWithContext mocks base method. +func (m *MockIAMAPI) CreateLoginProfileWithContext(arg0 aws.Context, arg1 *iam.CreateLoginProfileInput, arg2 ...request.Option) (*iam.CreateLoginProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateLoginProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateLoginProfileWithContext indicates an expected call of CreateLoginProfileWithContext. +func (mr *MockIAMAPIMockRecorder) CreateLoginProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoginProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateLoginProfileWithContext), varargs...) +} + +// CreateOpenIDConnectProvider mocks base method. +func (m *MockIAMAPI) CreateOpenIDConnectProvider(arg0 *iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOpenIDConnectProvider", arg0) + ret0, _ := ret[0].(*iam.CreateOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOpenIDConnectProvider indicates an expected call of CreateOpenIDConnectProvider. +func (mr *MockIAMAPIMockRecorder) CreateOpenIDConnectProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOpenIDConnectProvider", reflect.TypeOf((*MockIAMAPI)(nil).CreateOpenIDConnectProvider), arg0) +} + +// CreateOpenIDConnectProviderRequest mocks base method. +func (m *MockIAMAPI) CreateOpenIDConnectProviderRequest(arg0 *iam.CreateOpenIDConnectProviderInput) (*request.Request, *iam.CreateOpenIDConnectProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOpenIDConnectProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateOpenIDConnectProviderOutput) + return ret0, ret1 +} + +// CreateOpenIDConnectProviderRequest indicates an expected call of CreateOpenIDConnectProviderRequest. +func (mr *MockIAMAPIMockRecorder) CreateOpenIDConnectProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOpenIDConnectProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateOpenIDConnectProviderRequest), arg0) +} + +// CreateOpenIDConnectProviderWithContext mocks base method. +func (m *MockIAMAPI) CreateOpenIDConnectProviderWithContext(arg0 aws.Context, arg1 *iam.CreateOpenIDConnectProviderInput, arg2 ...request.Option) (*iam.CreateOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateOpenIDConnectProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOpenIDConnectProviderWithContext indicates an expected call of CreateOpenIDConnectProviderWithContext. +func (mr *MockIAMAPIMockRecorder) CreateOpenIDConnectProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOpenIDConnectProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateOpenIDConnectProviderWithContext), varargs...) +} + +// CreatePolicy mocks base method. +func (m *MockIAMAPI) CreatePolicy(arg0 *iam.CreatePolicyInput) (*iam.CreatePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreatePolicy", arg0) + ret0, _ := ret[0].(*iam.CreatePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreatePolicy indicates an expected call of CreatePolicy. +func (mr *MockIAMAPIMockRecorder) CreatePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicy", reflect.TypeOf((*MockIAMAPI)(nil).CreatePolicy), arg0) +} + +// CreatePolicyRequest mocks base method. +func (m *MockIAMAPI) CreatePolicyRequest(arg0 *iam.CreatePolicyInput) (*request.Request, *iam.CreatePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreatePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreatePolicyOutput) + return ret0, ret1 +} + +// CreatePolicyRequest indicates an expected call of CreatePolicyRequest. +func (mr *MockIAMAPIMockRecorder) CreatePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreatePolicyRequest), arg0) +} + +// CreatePolicyVersion mocks base method. +func (m *MockIAMAPI) CreatePolicyVersion(arg0 *iam.CreatePolicyVersionInput) (*iam.CreatePolicyVersionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreatePolicyVersion", arg0) + ret0, _ := ret[0].(*iam.CreatePolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreatePolicyVersion indicates an expected call of CreatePolicyVersion. +func (mr *MockIAMAPIMockRecorder) CreatePolicyVersion(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicyVersion", reflect.TypeOf((*MockIAMAPI)(nil).CreatePolicyVersion), arg0) +} + +// CreatePolicyVersionRequest mocks base method. +func (m *MockIAMAPI) CreatePolicyVersionRequest(arg0 *iam.CreatePolicyVersionInput) (*request.Request, *iam.CreatePolicyVersionOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreatePolicyVersionRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreatePolicyVersionOutput) + return ret0, ret1 +} + +// CreatePolicyVersionRequest indicates an expected call of CreatePolicyVersionRequest. +func (mr *MockIAMAPIMockRecorder) CreatePolicyVersionRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicyVersionRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreatePolicyVersionRequest), arg0) +} + +// CreatePolicyVersionWithContext mocks base method. +func (m *MockIAMAPI) CreatePolicyVersionWithContext(arg0 aws.Context, arg1 *iam.CreatePolicyVersionInput, arg2 ...request.Option) (*iam.CreatePolicyVersionOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreatePolicyVersionWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreatePolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreatePolicyVersionWithContext indicates an expected call of CreatePolicyVersionWithContext. +func (mr *MockIAMAPIMockRecorder) CreatePolicyVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicyVersionWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreatePolicyVersionWithContext), varargs...) +} + +// CreatePolicyWithContext mocks base method. +func (m *MockIAMAPI) CreatePolicyWithContext(arg0 aws.Context, arg1 *iam.CreatePolicyInput, arg2 ...request.Option) (*iam.CreatePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreatePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreatePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreatePolicyWithContext indicates an expected call of CreatePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) CreatePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreatePolicyWithContext), varargs...) +} + +// CreateRole mocks base method. +func (m *MockIAMAPI) CreateRole(arg0 *iam.CreateRoleInput) (*iam.CreateRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRole", arg0) + ret0, _ := ret[0].(*iam.CreateRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRole indicates an expected call of CreateRole. +func (mr *MockIAMAPIMockRecorder) CreateRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRole", reflect.TypeOf((*MockIAMAPI)(nil).CreateRole), arg0) +} + +// CreateRoleRequest mocks base method. +func (m *MockIAMAPI) CreateRoleRequest(arg0 *iam.CreateRoleInput) (*request.Request, *iam.CreateRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateRoleOutput) + return ret0, ret1 +} + +// CreateRoleRequest indicates an expected call of CreateRoleRequest. +func (mr *MockIAMAPIMockRecorder) CreateRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateRoleRequest), arg0) +} + +// CreateRoleWithContext mocks base method. +func (m *MockIAMAPI) CreateRoleWithContext(arg0 aws.Context, arg1 *iam.CreateRoleInput, arg2 ...request.Option) (*iam.CreateRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRoleWithContext indicates an expected call of CreateRoleWithContext. +func (mr *MockIAMAPIMockRecorder) CreateRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateRoleWithContext), varargs...) +} + +// CreateSAMLProvider mocks base method. +func (m *MockIAMAPI) CreateSAMLProvider(arg0 *iam.CreateSAMLProviderInput) (*iam.CreateSAMLProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateSAMLProvider", arg0) + ret0, _ := ret[0].(*iam.CreateSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateSAMLProvider indicates an expected call of CreateSAMLProvider. +func (mr *MockIAMAPIMockRecorder) CreateSAMLProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSAMLProvider", reflect.TypeOf((*MockIAMAPI)(nil).CreateSAMLProvider), arg0) +} + +// CreateSAMLProviderRequest mocks base method. +func (m *MockIAMAPI) CreateSAMLProviderRequest(arg0 *iam.CreateSAMLProviderInput) (*request.Request, *iam.CreateSAMLProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateSAMLProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateSAMLProviderOutput) + return ret0, ret1 +} + +// CreateSAMLProviderRequest indicates an expected call of CreateSAMLProviderRequest. +func (mr *MockIAMAPIMockRecorder) CreateSAMLProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSAMLProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateSAMLProviderRequest), arg0) +} + +// CreateSAMLProviderWithContext mocks base method. +func (m *MockIAMAPI) CreateSAMLProviderWithContext(arg0 aws.Context, arg1 *iam.CreateSAMLProviderInput, arg2 ...request.Option) (*iam.CreateSAMLProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateSAMLProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateSAMLProviderWithContext indicates an expected call of CreateSAMLProviderWithContext. +func (mr *MockIAMAPIMockRecorder) CreateSAMLProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSAMLProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateSAMLProviderWithContext), varargs...) +} + +// CreateServiceLinkedRole mocks base method. +func (m *MockIAMAPI) CreateServiceLinkedRole(arg0 *iam.CreateServiceLinkedRoleInput) (*iam.CreateServiceLinkedRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateServiceLinkedRole", arg0) + ret0, _ := ret[0].(*iam.CreateServiceLinkedRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateServiceLinkedRole indicates an expected call of CreateServiceLinkedRole. +func (mr *MockIAMAPIMockRecorder) CreateServiceLinkedRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceLinkedRole", reflect.TypeOf((*MockIAMAPI)(nil).CreateServiceLinkedRole), arg0) +} + +// CreateServiceLinkedRoleRequest mocks base method. +func (m *MockIAMAPI) CreateServiceLinkedRoleRequest(arg0 *iam.CreateServiceLinkedRoleInput) (*request.Request, *iam.CreateServiceLinkedRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateServiceLinkedRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateServiceLinkedRoleOutput) + return ret0, ret1 +} + +// CreateServiceLinkedRoleRequest indicates an expected call of CreateServiceLinkedRoleRequest. +func (mr *MockIAMAPIMockRecorder) CreateServiceLinkedRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceLinkedRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateServiceLinkedRoleRequest), arg0) +} + +// CreateServiceLinkedRoleWithContext mocks base method. +func (m *MockIAMAPI) CreateServiceLinkedRoleWithContext(arg0 aws.Context, arg1 *iam.CreateServiceLinkedRoleInput, arg2 ...request.Option) (*iam.CreateServiceLinkedRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateServiceLinkedRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateServiceLinkedRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateServiceLinkedRoleWithContext indicates an expected call of CreateServiceLinkedRoleWithContext. +func (mr *MockIAMAPIMockRecorder) CreateServiceLinkedRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceLinkedRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateServiceLinkedRoleWithContext), varargs...) +} + +// CreateServiceSpecificCredential mocks base method. +func (m *MockIAMAPI) CreateServiceSpecificCredential(arg0 *iam.CreateServiceSpecificCredentialInput) (*iam.CreateServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateServiceSpecificCredential", arg0) + ret0, _ := ret[0].(*iam.CreateServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateServiceSpecificCredential indicates an expected call of CreateServiceSpecificCredential. +func (mr *MockIAMAPIMockRecorder) CreateServiceSpecificCredential(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceSpecificCredential", reflect.TypeOf((*MockIAMAPI)(nil).CreateServiceSpecificCredential), arg0) +} + +// CreateServiceSpecificCredentialRequest mocks base method. +func (m *MockIAMAPI) CreateServiceSpecificCredentialRequest(arg0 *iam.CreateServiceSpecificCredentialInput) (*request.Request, *iam.CreateServiceSpecificCredentialOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateServiceSpecificCredentialRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateServiceSpecificCredentialOutput) + return ret0, ret1 +} + +// CreateServiceSpecificCredentialRequest indicates an expected call of CreateServiceSpecificCredentialRequest. +func (mr *MockIAMAPIMockRecorder) CreateServiceSpecificCredentialRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceSpecificCredentialRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateServiceSpecificCredentialRequest), arg0) +} + +// CreateServiceSpecificCredentialWithContext mocks base method. +func (m *MockIAMAPI) CreateServiceSpecificCredentialWithContext(arg0 aws.Context, arg1 *iam.CreateServiceSpecificCredentialInput, arg2 ...request.Option) (*iam.CreateServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateServiceSpecificCredentialWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateServiceSpecificCredentialWithContext indicates an expected call of CreateServiceSpecificCredentialWithContext. +func (mr *MockIAMAPIMockRecorder) CreateServiceSpecificCredentialWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateServiceSpecificCredentialWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateServiceSpecificCredentialWithContext), varargs...) +} + +// CreateUser mocks base method. +func (m *MockIAMAPI) CreateUser(arg0 *iam.CreateUserInput) (*iam.CreateUserOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateUser", arg0) + ret0, _ := ret[0].(*iam.CreateUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateUser indicates an expected call of CreateUser. +func (mr *MockIAMAPIMockRecorder) CreateUser(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUser", reflect.TypeOf((*MockIAMAPI)(nil).CreateUser), arg0) +} + +// CreateUserRequest mocks base method. +func (m *MockIAMAPI) CreateUserRequest(arg0 *iam.CreateUserInput) (*request.Request, *iam.CreateUserOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateUserRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateUserOutput) + return ret0, ret1 +} + +// CreateUserRequest indicates an expected call of CreateUserRequest. +func (mr *MockIAMAPIMockRecorder) CreateUserRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUserRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateUserRequest), arg0) +} + +// CreateUserWithContext mocks base method. +func (m *MockIAMAPI) CreateUserWithContext(arg0 aws.Context, arg1 *iam.CreateUserInput, arg2 ...request.Option) (*iam.CreateUserOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateUserWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateUserWithContext indicates an expected call of CreateUserWithContext. +func (mr *MockIAMAPIMockRecorder) CreateUserWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUserWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateUserWithContext), varargs...) +} + +// CreateVirtualMFADevice mocks base method. +func (m *MockIAMAPI) CreateVirtualMFADevice(arg0 *iam.CreateVirtualMFADeviceInput) (*iam.CreateVirtualMFADeviceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateVirtualMFADevice", arg0) + ret0, _ := ret[0].(*iam.CreateVirtualMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateVirtualMFADevice indicates an expected call of CreateVirtualMFADevice. +func (mr *MockIAMAPIMockRecorder) CreateVirtualMFADevice(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateVirtualMFADevice", reflect.TypeOf((*MockIAMAPI)(nil).CreateVirtualMFADevice), arg0) +} + +// CreateVirtualMFADeviceRequest mocks base method. +func (m *MockIAMAPI) CreateVirtualMFADeviceRequest(arg0 *iam.CreateVirtualMFADeviceInput) (*request.Request, *iam.CreateVirtualMFADeviceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateVirtualMFADeviceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.CreateVirtualMFADeviceOutput) + return ret0, ret1 +} + +// CreateVirtualMFADeviceRequest indicates an expected call of CreateVirtualMFADeviceRequest. +func (mr *MockIAMAPIMockRecorder) CreateVirtualMFADeviceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateVirtualMFADeviceRequest", reflect.TypeOf((*MockIAMAPI)(nil).CreateVirtualMFADeviceRequest), arg0) +} + +// CreateVirtualMFADeviceWithContext mocks base method. +func (m *MockIAMAPI) CreateVirtualMFADeviceWithContext(arg0 aws.Context, arg1 *iam.CreateVirtualMFADeviceInput, arg2 ...request.Option) (*iam.CreateVirtualMFADeviceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateVirtualMFADeviceWithContext", varargs...) + ret0, _ := ret[0].(*iam.CreateVirtualMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateVirtualMFADeviceWithContext indicates an expected call of CreateVirtualMFADeviceWithContext. +func (mr *MockIAMAPIMockRecorder) CreateVirtualMFADeviceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateVirtualMFADeviceWithContext", reflect.TypeOf((*MockIAMAPI)(nil).CreateVirtualMFADeviceWithContext), varargs...) +} + +// DeactivateMFADevice mocks base method. +func (m *MockIAMAPI) DeactivateMFADevice(arg0 *iam.DeactivateMFADeviceInput) (*iam.DeactivateMFADeviceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeactivateMFADevice", arg0) + ret0, _ := ret[0].(*iam.DeactivateMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeactivateMFADevice indicates an expected call of DeactivateMFADevice. +func (mr *MockIAMAPIMockRecorder) DeactivateMFADevice(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeactivateMFADevice", reflect.TypeOf((*MockIAMAPI)(nil).DeactivateMFADevice), arg0) +} + +// DeactivateMFADeviceRequest mocks base method. +func (m *MockIAMAPI) DeactivateMFADeviceRequest(arg0 *iam.DeactivateMFADeviceInput) (*request.Request, *iam.DeactivateMFADeviceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeactivateMFADeviceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeactivateMFADeviceOutput) + return ret0, ret1 +} + +// DeactivateMFADeviceRequest indicates an expected call of DeactivateMFADeviceRequest. +func (mr *MockIAMAPIMockRecorder) DeactivateMFADeviceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeactivateMFADeviceRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeactivateMFADeviceRequest), arg0) +} + +// DeactivateMFADeviceWithContext mocks base method. +func (m *MockIAMAPI) DeactivateMFADeviceWithContext(arg0 aws.Context, arg1 *iam.DeactivateMFADeviceInput, arg2 ...request.Option) (*iam.DeactivateMFADeviceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeactivateMFADeviceWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeactivateMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeactivateMFADeviceWithContext indicates an expected call of DeactivateMFADeviceWithContext. +func (mr *MockIAMAPIMockRecorder) DeactivateMFADeviceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeactivateMFADeviceWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeactivateMFADeviceWithContext), varargs...) +} + +// DeleteAccessKey mocks base method. +func (m *MockIAMAPI) DeleteAccessKey(arg0 *iam.DeleteAccessKeyInput) (*iam.DeleteAccessKeyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteAccessKey", arg0) + ret0, _ := ret[0].(*iam.DeleteAccessKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteAccessKey indicates an expected call of DeleteAccessKey. +func (mr *MockIAMAPIMockRecorder) DeleteAccessKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccessKey", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccessKey), arg0) +} + +// DeleteAccessKeyRequest mocks base method. +func (m *MockIAMAPI) DeleteAccessKeyRequest(arg0 *iam.DeleteAccessKeyInput) (*request.Request, *iam.DeleteAccessKeyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteAccessKeyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteAccessKeyOutput) + return ret0, ret1 +} + +// DeleteAccessKeyRequest indicates an expected call of DeleteAccessKeyRequest. +func (mr *MockIAMAPIMockRecorder) DeleteAccessKeyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccessKeyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccessKeyRequest), arg0) +} + +// DeleteAccessKeyWithContext mocks base method. +func (m *MockIAMAPI) DeleteAccessKeyWithContext(arg0 aws.Context, arg1 *iam.DeleteAccessKeyInput, arg2 ...request.Option) (*iam.DeleteAccessKeyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAccessKeyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteAccessKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteAccessKeyWithContext indicates an expected call of DeleteAccessKeyWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteAccessKeyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccessKeyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccessKeyWithContext), varargs...) +} + +// DeleteAccountAlias mocks base method. +func (m *MockIAMAPI) DeleteAccountAlias(arg0 *iam.DeleteAccountAliasInput) (*iam.DeleteAccountAliasOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteAccountAlias", arg0) + ret0, _ := ret[0].(*iam.DeleteAccountAliasOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteAccountAlias indicates an expected call of DeleteAccountAlias. +func (mr *MockIAMAPIMockRecorder) DeleteAccountAlias(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccountAlias", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccountAlias), arg0) +} + +// DeleteAccountAliasRequest mocks base method. +func (m *MockIAMAPI) DeleteAccountAliasRequest(arg0 *iam.DeleteAccountAliasInput) (*request.Request, *iam.DeleteAccountAliasOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteAccountAliasRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteAccountAliasOutput) + return ret0, ret1 +} + +// DeleteAccountAliasRequest indicates an expected call of DeleteAccountAliasRequest. +func (mr *MockIAMAPIMockRecorder) DeleteAccountAliasRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccountAliasRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccountAliasRequest), arg0) +} + +// DeleteAccountAliasWithContext mocks base method. +func (m *MockIAMAPI) DeleteAccountAliasWithContext(arg0 aws.Context, arg1 *iam.DeleteAccountAliasInput, arg2 ...request.Option) (*iam.DeleteAccountAliasOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAccountAliasWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteAccountAliasOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteAccountAliasWithContext indicates an expected call of DeleteAccountAliasWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteAccountAliasWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccountAliasWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccountAliasWithContext), varargs...) +} + +// DeleteAccountPasswordPolicy mocks base method. +func (m *MockIAMAPI) DeleteAccountPasswordPolicy(arg0 *iam.DeleteAccountPasswordPolicyInput) (*iam.DeleteAccountPasswordPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteAccountPasswordPolicy", arg0) + ret0, _ := ret[0].(*iam.DeleteAccountPasswordPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteAccountPasswordPolicy indicates an expected call of DeleteAccountPasswordPolicy. +func (mr *MockIAMAPIMockRecorder) DeleteAccountPasswordPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccountPasswordPolicy", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccountPasswordPolicy), arg0) +} + +// DeleteAccountPasswordPolicyRequest mocks base method. +func (m *MockIAMAPI) DeleteAccountPasswordPolicyRequest(arg0 *iam.DeleteAccountPasswordPolicyInput) (*request.Request, *iam.DeleteAccountPasswordPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteAccountPasswordPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteAccountPasswordPolicyOutput) + return ret0, ret1 +} + +// DeleteAccountPasswordPolicyRequest indicates an expected call of DeleteAccountPasswordPolicyRequest. +func (mr *MockIAMAPIMockRecorder) DeleteAccountPasswordPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccountPasswordPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccountPasswordPolicyRequest), arg0) +} + +// DeleteAccountPasswordPolicyWithContext mocks base method. +func (m *MockIAMAPI) DeleteAccountPasswordPolicyWithContext(arg0 aws.Context, arg1 *iam.DeleteAccountPasswordPolicyInput, arg2 ...request.Option) (*iam.DeleteAccountPasswordPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteAccountPasswordPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteAccountPasswordPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteAccountPasswordPolicyWithContext indicates an expected call of DeleteAccountPasswordPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteAccountPasswordPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccountPasswordPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteAccountPasswordPolicyWithContext), varargs...) +} + +// DeleteGroup mocks base method. +func (m *MockIAMAPI) DeleteGroup(arg0 *iam.DeleteGroupInput) (*iam.DeleteGroupOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteGroup", arg0) + ret0, _ := ret[0].(*iam.DeleteGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteGroup indicates an expected call of DeleteGroup. +func (mr *MockIAMAPIMockRecorder) DeleteGroup(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroup", reflect.TypeOf((*MockIAMAPI)(nil).DeleteGroup), arg0) +} + +// DeleteGroupPolicy mocks base method. +func (m *MockIAMAPI) DeleteGroupPolicy(arg0 *iam.DeleteGroupPolicyInput) (*iam.DeleteGroupPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteGroupPolicy", arg0) + ret0, _ := ret[0].(*iam.DeleteGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteGroupPolicy indicates an expected call of DeleteGroupPolicy. +func (mr *MockIAMAPIMockRecorder) DeleteGroupPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroupPolicy", reflect.TypeOf((*MockIAMAPI)(nil).DeleteGroupPolicy), arg0) +} + +// DeleteGroupPolicyRequest mocks base method. +func (m *MockIAMAPI) DeleteGroupPolicyRequest(arg0 *iam.DeleteGroupPolicyInput) (*request.Request, *iam.DeleteGroupPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteGroupPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteGroupPolicyOutput) + return ret0, ret1 +} + +// DeleteGroupPolicyRequest indicates an expected call of DeleteGroupPolicyRequest. +func (mr *MockIAMAPIMockRecorder) DeleteGroupPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroupPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteGroupPolicyRequest), arg0) +} + +// DeleteGroupPolicyWithContext mocks base method. +func (m *MockIAMAPI) DeleteGroupPolicyWithContext(arg0 aws.Context, arg1 *iam.DeleteGroupPolicyInput, arg2 ...request.Option) (*iam.DeleteGroupPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteGroupPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteGroupPolicyWithContext indicates an expected call of DeleteGroupPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteGroupPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroupPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteGroupPolicyWithContext), varargs...) +} + +// DeleteGroupRequest mocks base method. +func (m *MockIAMAPI) DeleteGroupRequest(arg0 *iam.DeleteGroupInput) (*request.Request, *iam.DeleteGroupOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteGroupRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteGroupOutput) + return ret0, ret1 +} + +// DeleteGroupRequest indicates an expected call of DeleteGroupRequest. +func (mr *MockIAMAPIMockRecorder) DeleteGroupRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroupRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteGroupRequest), arg0) +} + +// DeleteGroupWithContext mocks base method. +func (m *MockIAMAPI) DeleteGroupWithContext(arg0 aws.Context, arg1 *iam.DeleteGroupInput, arg2 ...request.Option) (*iam.DeleteGroupOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteGroupWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteGroupWithContext indicates an expected call of DeleteGroupWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroupWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteGroupWithContext), varargs...) +} + +// DeleteInstanceProfile mocks base method. +func (m *MockIAMAPI) DeleteInstanceProfile(arg0 *iam.DeleteInstanceProfileInput) (*iam.DeleteInstanceProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteInstanceProfile", arg0) + ret0, _ := ret[0].(*iam.DeleteInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteInstanceProfile indicates an expected call of DeleteInstanceProfile. +func (mr *MockIAMAPIMockRecorder) DeleteInstanceProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteInstanceProfile", reflect.TypeOf((*MockIAMAPI)(nil).DeleteInstanceProfile), arg0) +} + +// DeleteInstanceProfileRequest mocks base method. +func (m *MockIAMAPI) DeleteInstanceProfileRequest(arg0 *iam.DeleteInstanceProfileInput) (*request.Request, *iam.DeleteInstanceProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteInstanceProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteInstanceProfileOutput) + return ret0, ret1 +} + +// DeleteInstanceProfileRequest indicates an expected call of DeleteInstanceProfileRequest. +func (mr *MockIAMAPIMockRecorder) DeleteInstanceProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteInstanceProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteInstanceProfileRequest), arg0) +} + +// DeleteInstanceProfileWithContext mocks base method. +func (m *MockIAMAPI) DeleteInstanceProfileWithContext(arg0 aws.Context, arg1 *iam.DeleteInstanceProfileInput, arg2 ...request.Option) (*iam.DeleteInstanceProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteInstanceProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteInstanceProfileWithContext indicates an expected call of DeleteInstanceProfileWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteInstanceProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteInstanceProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteInstanceProfileWithContext), varargs...) +} + +// DeleteLoginProfile mocks base method. +func (m *MockIAMAPI) DeleteLoginProfile(arg0 *iam.DeleteLoginProfileInput) (*iam.DeleteLoginProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteLoginProfile", arg0) + ret0, _ := ret[0].(*iam.DeleteLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteLoginProfile indicates an expected call of DeleteLoginProfile. +func (mr *MockIAMAPIMockRecorder) DeleteLoginProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoginProfile", reflect.TypeOf((*MockIAMAPI)(nil).DeleteLoginProfile), arg0) +} + +// DeleteLoginProfileRequest mocks base method. +func (m *MockIAMAPI) DeleteLoginProfileRequest(arg0 *iam.DeleteLoginProfileInput) (*request.Request, *iam.DeleteLoginProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteLoginProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteLoginProfileOutput) + return ret0, ret1 +} + +// DeleteLoginProfileRequest indicates an expected call of DeleteLoginProfileRequest. +func (mr *MockIAMAPIMockRecorder) DeleteLoginProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoginProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteLoginProfileRequest), arg0) +} + +// DeleteLoginProfileWithContext mocks base method. +func (m *MockIAMAPI) DeleteLoginProfileWithContext(arg0 aws.Context, arg1 *iam.DeleteLoginProfileInput, arg2 ...request.Option) (*iam.DeleteLoginProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteLoginProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteLoginProfileWithContext indicates an expected call of DeleteLoginProfileWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteLoginProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoginProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteLoginProfileWithContext), varargs...) +} + +// DeleteOpenIDConnectProvider mocks base method. +func (m *MockIAMAPI) DeleteOpenIDConnectProvider(arg0 *iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteOpenIDConnectProvider", arg0) + ret0, _ := ret[0].(*iam.DeleteOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteOpenIDConnectProvider indicates an expected call of DeleteOpenIDConnectProvider. +func (mr *MockIAMAPIMockRecorder) DeleteOpenIDConnectProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOpenIDConnectProvider", reflect.TypeOf((*MockIAMAPI)(nil).DeleteOpenIDConnectProvider), arg0) +} + +// DeleteOpenIDConnectProviderRequest mocks base method. +func (m *MockIAMAPI) DeleteOpenIDConnectProviderRequest(arg0 *iam.DeleteOpenIDConnectProviderInput) (*request.Request, *iam.DeleteOpenIDConnectProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteOpenIDConnectProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteOpenIDConnectProviderOutput) + return ret0, ret1 +} + +// DeleteOpenIDConnectProviderRequest indicates an expected call of DeleteOpenIDConnectProviderRequest. +func (mr *MockIAMAPIMockRecorder) DeleteOpenIDConnectProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOpenIDConnectProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteOpenIDConnectProviderRequest), arg0) +} + +// DeleteOpenIDConnectProviderWithContext mocks base method. +func (m *MockIAMAPI) DeleteOpenIDConnectProviderWithContext(arg0 aws.Context, arg1 *iam.DeleteOpenIDConnectProviderInput, arg2 ...request.Option) (*iam.DeleteOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteOpenIDConnectProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteOpenIDConnectProviderWithContext indicates an expected call of DeleteOpenIDConnectProviderWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteOpenIDConnectProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOpenIDConnectProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteOpenIDConnectProviderWithContext), varargs...) +} + +// DeletePolicy mocks base method. +func (m *MockIAMAPI) DeletePolicy(arg0 *iam.DeletePolicyInput) (*iam.DeletePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePolicy", arg0) + ret0, _ := ret[0].(*iam.DeletePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePolicy indicates an expected call of DeletePolicy. +func (mr *MockIAMAPIMockRecorder) DeletePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicy", reflect.TypeOf((*MockIAMAPI)(nil).DeletePolicy), arg0) +} + +// DeletePolicyRequest mocks base method. +func (m *MockIAMAPI) DeletePolicyRequest(arg0 *iam.DeletePolicyInput) (*request.Request, *iam.DeletePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeletePolicyOutput) + return ret0, ret1 +} + +// DeletePolicyRequest indicates an expected call of DeletePolicyRequest. +func (mr *MockIAMAPIMockRecorder) DeletePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeletePolicyRequest), arg0) +} + +// DeletePolicyVersion mocks base method. +func (m *MockIAMAPI) DeletePolicyVersion(arg0 *iam.DeletePolicyVersionInput) (*iam.DeletePolicyVersionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePolicyVersion", arg0) + ret0, _ := ret[0].(*iam.DeletePolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePolicyVersion indicates an expected call of DeletePolicyVersion. +func (mr *MockIAMAPIMockRecorder) DeletePolicyVersion(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicyVersion", reflect.TypeOf((*MockIAMAPI)(nil).DeletePolicyVersion), arg0) +} + +// DeletePolicyVersionRequest mocks base method. +func (m *MockIAMAPI) DeletePolicyVersionRequest(arg0 *iam.DeletePolicyVersionInput) (*request.Request, *iam.DeletePolicyVersionOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePolicyVersionRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeletePolicyVersionOutput) + return ret0, ret1 +} + +// DeletePolicyVersionRequest indicates an expected call of DeletePolicyVersionRequest. +func (mr *MockIAMAPIMockRecorder) DeletePolicyVersionRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicyVersionRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeletePolicyVersionRequest), arg0) +} + +// DeletePolicyVersionWithContext mocks base method. +func (m *MockIAMAPI) DeletePolicyVersionWithContext(arg0 aws.Context, arg1 *iam.DeletePolicyVersionInput, arg2 ...request.Option) (*iam.DeletePolicyVersionOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeletePolicyVersionWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeletePolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePolicyVersionWithContext indicates an expected call of DeletePolicyVersionWithContext. +func (mr *MockIAMAPIMockRecorder) DeletePolicyVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicyVersionWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeletePolicyVersionWithContext), varargs...) +} + +// DeletePolicyWithContext mocks base method. +func (m *MockIAMAPI) DeletePolicyWithContext(arg0 aws.Context, arg1 *iam.DeletePolicyInput, arg2 ...request.Option) (*iam.DeletePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeletePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeletePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePolicyWithContext indicates an expected call of DeletePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DeletePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeletePolicyWithContext), varargs...) +} + +// DeleteRole mocks base method. +func (m *MockIAMAPI) DeleteRole(arg0 *iam.DeleteRoleInput) (*iam.DeleteRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRole", arg0) + ret0, _ := ret[0].(*iam.DeleteRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRole indicates an expected call of DeleteRole. +func (mr *MockIAMAPIMockRecorder) DeleteRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRole", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRole), arg0) +} + +// DeleteRolePermissionsBoundary mocks base method. +func (m *MockIAMAPI) DeleteRolePermissionsBoundary(arg0 *iam.DeleteRolePermissionsBoundaryInput) (*iam.DeleteRolePermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRolePermissionsBoundary", arg0) + ret0, _ := ret[0].(*iam.DeleteRolePermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRolePermissionsBoundary indicates an expected call of DeleteRolePermissionsBoundary. +func (mr *MockIAMAPIMockRecorder) DeleteRolePermissionsBoundary(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRolePermissionsBoundary", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRolePermissionsBoundary), arg0) +} + +// DeleteRolePermissionsBoundaryRequest mocks base method. +func (m *MockIAMAPI) DeleteRolePermissionsBoundaryRequest(arg0 *iam.DeleteRolePermissionsBoundaryInput) (*request.Request, *iam.DeleteRolePermissionsBoundaryOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRolePermissionsBoundaryRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteRolePermissionsBoundaryOutput) + return ret0, ret1 +} + +// DeleteRolePermissionsBoundaryRequest indicates an expected call of DeleteRolePermissionsBoundaryRequest. +func (mr *MockIAMAPIMockRecorder) DeleteRolePermissionsBoundaryRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRolePermissionsBoundaryRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRolePermissionsBoundaryRequest), arg0) +} + +// DeleteRolePermissionsBoundaryWithContext mocks base method. +func (m *MockIAMAPI) DeleteRolePermissionsBoundaryWithContext(arg0 aws.Context, arg1 *iam.DeleteRolePermissionsBoundaryInput, arg2 ...request.Option) (*iam.DeleteRolePermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteRolePermissionsBoundaryWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteRolePermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRolePermissionsBoundaryWithContext indicates an expected call of DeleteRolePermissionsBoundaryWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteRolePermissionsBoundaryWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRolePermissionsBoundaryWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRolePermissionsBoundaryWithContext), varargs...) +} + +// DeleteRolePolicy mocks base method. +func (m *MockIAMAPI) DeleteRolePolicy(arg0 *iam.DeleteRolePolicyInput) (*iam.DeleteRolePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRolePolicy", arg0) + ret0, _ := ret[0].(*iam.DeleteRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRolePolicy indicates an expected call of DeleteRolePolicy. +func (mr *MockIAMAPIMockRecorder) DeleteRolePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRolePolicy", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRolePolicy), arg0) +} + +// DeleteRolePolicyRequest mocks base method. +func (m *MockIAMAPI) DeleteRolePolicyRequest(arg0 *iam.DeleteRolePolicyInput) (*request.Request, *iam.DeleteRolePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRolePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteRolePolicyOutput) + return ret0, ret1 +} + +// DeleteRolePolicyRequest indicates an expected call of DeleteRolePolicyRequest. +func (mr *MockIAMAPIMockRecorder) DeleteRolePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRolePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRolePolicyRequest), arg0) +} + +// DeleteRolePolicyWithContext mocks base method. +func (m *MockIAMAPI) DeleteRolePolicyWithContext(arg0 aws.Context, arg1 *iam.DeleteRolePolicyInput, arg2 ...request.Option) (*iam.DeleteRolePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteRolePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRolePolicyWithContext indicates an expected call of DeleteRolePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteRolePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRolePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRolePolicyWithContext), varargs...) +} + +// DeleteRoleRequest mocks base method. +func (m *MockIAMAPI) DeleteRoleRequest(arg0 *iam.DeleteRoleInput) (*request.Request, *iam.DeleteRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteRoleOutput) + return ret0, ret1 +} + +// DeleteRoleRequest indicates an expected call of DeleteRoleRequest. +func (mr *MockIAMAPIMockRecorder) DeleteRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRoleRequest), arg0) +} + +// DeleteRoleWithContext mocks base method. +func (m *MockIAMAPI) DeleteRoleWithContext(arg0 aws.Context, arg1 *iam.DeleteRoleInput, arg2 ...request.Option) (*iam.DeleteRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRoleWithContext indicates an expected call of DeleteRoleWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteRoleWithContext), varargs...) +} + +// DeleteSAMLProvider mocks base method. +func (m *MockIAMAPI) DeleteSAMLProvider(arg0 *iam.DeleteSAMLProviderInput) (*iam.DeleteSAMLProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteSAMLProvider", arg0) + ret0, _ := ret[0].(*iam.DeleteSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteSAMLProvider indicates an expected call of DeleteSAMLProvider. +func (mr *MockIAMAPIMockRecorder) DeleteSAMLProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSAMLProvider", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSAMLProvider), arg0) +} + +// DeleteSAMLProviderRequest mocks base method. +func (m *MockIAMAPI) DeleteSAMLProviderRequest(arg0 *iam.DeleteSAMLProviderInput) (*request.Request, *iam.DeleteSAMLProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteSAMLProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteSAMLProviderOutput) + return ret0, ret1 +} + +// DeleteSAMLProviderRequest indicates an expected call of DeleteSAMLProviderRequest. +func (mr *MockIAMAPIMockRecorder) DeleteSAMLProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSAMLProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSAMLProviderRequest), arg0) +} + +// DeleteSAMLProviderWithContext mocks base method. +func (m *MockIAMAPI) DeleteSAMLProviderWithContext(arg0 aws.Context, arg1 *iam.DeleteSAMLProviderInput, arg2 ...request.Option) (*iam.DeleteSAMLProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteSAMLProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteSAMLProviderWithContext indicates an expected call of DeleteSAMLProviderWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteSAMLProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSAMLProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSAMLProviderWithContext), varargs...) +} + +// DeleteSSHPublicKey mocks base method. +func (m *MockIAMAPI) DeleteSSHPublicKey(arg0 *iam.DeleteSSHPublicKeyInput) (*iam.DeleteSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteSSHPublicKey", arg0) + ret0, _ := ret[0].(*iam.DeleteSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteSSHPublicKey indicates an expected call of DeleteSSHPublicKey. +func (mr *MockIAMAPIMockRecorder) DeleteSSHPublicKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSSHPublicKey", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSSHPublicKey), arg0) +} + +// DeleteSSHPublicKeyRequest mocks base method. +func (m *MockIAMAPI) DeleteSSHPublicKeyRequest(arg0 *iam.DeleteSSHPublicKeyInput) (*request.Request, *iam.DeleteSSHPublicKeyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteSSHPublicKeyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteSSHPublicKeyOutput) + return ret0, ret1 +} + +// DeleteSSHPublicKeyRequest indicates an expected call of DeleteSSHPublicKeyRequest. +func (mr *MockIAMAPIMockRecorder) DeleteSSHPublicKeyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSSHPublicKeyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSSHPublicKeyRequest), arg0) +} + +// DeleteSSHPublicKeyWithContext mocks base method. +func (m *MockIAMAPI) DeleteSSHPublicKeyWithContext(arg0 aws.Context, arg1 *iam.DeleteSSHPublicKeyInput, arg2 ...request.Option) (*iam.DeleteSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteSSHPublicKeyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteSSHPublicKeyWithContext indicates an expected call of DeleteSSHPublicKeyWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteSSHPublicKeyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSSHPublicKeyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSSHPublicKeyWithContext), varargs...) +} + +// DeleteServerCertificate mocks base method. +func (m *MockIAMAPI) DeleteServerCertificate(arg0 *iam.DeleteServerCertificateInput) (*iam.DeleteServerCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteServerCertificate", arg0) + ret0, _ := ret[0].(*iam.DeleteServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteServerCertificate indicates an expected call of DeleteServerCertificate. +func (mr *MockIAMAPIMockRecorder) DeleteServerCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServerCertificate", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServerCertificate), arg0) +} + +// DeleteServerCertificateRequest mocks base method. +func (m *MockIAMAPI) DeleteServerCertificateRequest(arg0 *iam.DeleteServerCertificateInput) (*request.Request, *iam.DeleteServerCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteServerCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteServerCertificateOutput) + return ret0, ret1 +} + +// DeleteServerCertificateRequest indicates an expected call of DeleteServerCertificateRequest. +func (mr *MockIAMAPIMockRecorder) DeleteServerCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServerCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServerCertificateRequest), arg0) +} + +// DeleteServerCertificateWithContext mocks base method. +func (m *MockIAMAPI) DeleteServerCertificateWithContext(arg0 aws.Context, arg1 *iam.DeleteServerCertificateInput, arg2 ...request.Option) (*iam.DeleteServerCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteServerCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteServerCertificateWithContext indicates an expected call of DeleteServerCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteServerCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServerCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServerCertificateWithContext), varargs...) +} + +// DeleteServiceLinkedRole mocks base method. +func (m *MockIAMAPI) DeleteServiceLinkedRole(arg0 *iam.DeleteServiceLinkedRoleInput) (*iam.DeleteServiceLinkedRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteServiceLinkedRole", arg0) + ret0, _ := ret[0].(*iam.DeleteServiceLinkedRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteServiceLinkedRole indicates an expected call of DeleteServiceLinkedRole. +func (mr *MockIAMAPIMockRecorder) DeleteServiceLinkedRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceLinkedRole", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServiceLinkedRole), arg0) +} + +// DeleteServiceLinkedRoleRequest mocks base method. +func (m *MockIAMAPI) DeleteServiceLinkedRoleRequest(arg0 *iam.DeleteServiceLinkedRoleInput) (*request.Request, *iam.DeleteServiceLinkedRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteServiceLinkedRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteServiceLinkedRoleOutput) + return ret0, ret1 +} + +// DeleteServiceLinkedRoleRequest indicates an expected call of DeleteServiceLinkedRoleRequest. +func (mr *MockIAMAPIMockRecorder) DeleteServiceLinkedRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceLinkedRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServiceLinkedRoleRequest), arg0) +} + +// DeleteServiceLinkedRoleWithContext mocks base method. +func (m *MockIAMAPI) DeleteServiceLinkedRoleWithContext(arg0 aws.Context, arg1 *iam.DeleteServiceLinkedRoleInput, arg2 ...request.Option) (*iam.DeleteServiceLinkedRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteServiceLinkedRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteServiceLinkedRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteServiceLinkedRoleWithContext indicates an expected call of DeleteServiceLinkedRoleWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteServiceLinkedRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceLinkedRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServiceLinkedRoleWithContext), varargs...) +} + +// DeleteServiceSpecificCredential mocks base method. +func (m *MockIAMAPI) DeleteServiceSpecificCredential(arg0 *iam.DeleteServiceSpecificCredentialInput) (*iam.DeleteServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteServiceSpecificCredential", arg0) + ret0, _ := ret[0].(*iam.DeleteServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteServiceSpecificCredential indicates an expected call of DeleteServiceSpecificCredential. +func (mr *MockIAMAPIMockRecorder) DeleteServiceSpecificCredential(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceSpecificCredential", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServiceSpecificCredential), arg0) +} + +// DeleteServiceSpecificCredentialRequest mocks base method. +func (m *MockIAMAPI) DeleteServiceSpecificCredentialRequest(arg0 *iam.DeleteServiceSpecificCredentialInput) (*request.Request, *iam.DeleteServiceSpecificCredentialOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteServiceSpecificCredentialRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteServiceSpecificCredentialOutput) + return ret0, ret1 +} + +// DeleteServiceSpecificCredentialRequest indicates an expected call of DeleteServiceSpecificCredentialRequest. +func (mr *MockIAMAPIMockRecorder) DeleteServiceSpecificCredentialRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceSpecificCredentialRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServiceSpecificCredentialRequest), arg0) +} + +// DeleteServiceSpecificCredentialWithContext mocks base method. +func (m *MockIAMAPI) DeleteServiceSpecificCredentialWithContext(arg0 aws.Context, arg1 *iam.DeleteServiceSpecificCredentialInput, arg2 ...request.Option) (*iam.DeleteServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteServiceSpecificCredentialWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteServiceSpecificCredentialWithContext indicates an expected call of DeleteServiceSpecificCredentialWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteServiceSpecificCredentialWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteServiceSpecificCredentialWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteServiceSpecificCredentialWithContext), varargs...) +} + +// DeleteSigningCertificate mocks base method. +func (m *MockIAMAPI) DeleteSigningCertificate(arg0 *iam.DeleteSigningCertificateInput) (*iam.DeleteSigningCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteSigningCertificate", arg0) + ret0, _ := ret[0].(*iam.DeleteSigningCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteSigningCertificate indicates an expected call of DeleteSigningCertificate. +func (mr *MockIAMAPIMockRecorder) DeleteSigningCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSigningCertificate", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSigningCertificate), arg0) +} + +// DeleteSigningCertificateRequest mocks base method. +func (m *MockIAMAPI) DeleteSigningCertificateRequest(arg0 *iam.DeleteSigningCertificateInput) (*request.Request, *iam.DeleteSigningCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteSigningCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteSigningCertificateOutput) + return ret0, ret1 +} + +// DeleteSigningCertificateRequest indicates an expected call of DeleteSigningCertificateRequest. +func (mr *MockIAMAPIMockRecorder) DeleteSigningCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSigningCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSigningCertificateRequest), arg0) +} + +// DeleteSigningCertificateWithContext mocks base method. +func (m *MockIAMAPI) DeleteSigningCertificateWithContext(arg0 aws.Context, arg1 *iam.DeleteSigningCertificateInput, arg2 ...request.Option) (*iam.DeleteSigningCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteSigningCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteSigningCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteSigningCertificateWithContext indicates an expected call of DeleteSigningCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteSigningCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSigningCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteSigningCertificateWithContext), varargs...) +} + +// DeleteUser mocks base method. +func (m *MockIAMAPI) DeleteUser(arg0 *iam.DeleteUserInput) (*iam.DeleteUserOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteUser", arg0) + ret0, _ := ret[0].(*iam.DeleteUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteUser indicates an expected call of DeleteUser. +func (mr *MockIAMAPIMockRecorder) DeleteUser(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUser", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUser), arg0) +} + +// DeleteUserPermissionsBoundary mocks base method. +func (m *MockIAMAPI) DeleteUserPermissionsBoundary(arg0 *iam.DeleteUserPermissionsBoundaryInput) (*iam.DeleteUserPermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteUserPermissionsBoundary", arg0) + ret0, _ := ret[0].(*iam.DeleteUserPermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteUserPermissionsBoundary indicates an expected call of DeleteUserPermissionsBoundary. +func (mr *MockIAMAPIMockRecorder) DeleteUserPermissionsBoundary(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserPermissionsBoundary", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserPermissionsBoundary), arg0) +} + +// DeleteUserPermissionsBoundaryRequest mocks base method. +func (m *MockIAMAPI) DeleteUserPermissionsBoundaryRequest(arg0 *iam.DeleteUserPermissionsBoundaryInput) (*request.Request, *iam.DeleteUserPermissionsBoundaryOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteUserPermissionsBoundaryRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteUserPermissionsBoundaryOutput) + return ret0, ret1 +} + +// DeleteUserPermissionsBoundaryRequest indicates an expected call of DeleteUserPermissionsBoundaryRequest. +func (mr *MockIAMAPIMockRecorder) DeleteUserPermissionsBoundaryRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserPermissionsBoundaryRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserPermissionsBoundaryRequest), arg0) +} + +// DeleteUserPermissionsBoundaryWithContext mocks base method. +func (m *MockIAMAPI) DeleteUserPermissionsBoundaryWithContext(arg0 aws.Context, arg1 *iam.DeleteUserPermissionsBoundaryInput, arg2 ...request.Option) (*iam.DeleteUserPermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteUserPermissionsBoundaryWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteUserPermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteUserPermissionsBoundaryWithContext indicates an expected call of DeleteUserPermissionsBoundaryWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteUserPermissionsBoundaryWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserPermissionsBoundaryWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserPermissionsBoundaryWithContext), varargs...) +} + +// DeleteUserPolicy mocks base method. +func (m *MockIAMAPI) DeleteUserPolicy(arg0 *iam.DeleteUserPolicyInput) (*iam.DeleteUserPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteUserPolicy", arg0) + ret0, _ := ret[0].(*iam.DeleteUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteUserPolicy indicates an expected call of DeleteUserPolicy. +func (mr *MockIAMAPIMockRecorder) DeleteUserPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserPolicy", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserPolicy), arg0) +} + +// DeleteUserPolicyRequest mocks base method. +func (m *MockIAMAPI) DeleteUserPolicyRequest(arg0 *iam.DeleteUserPolicyInput) (*request.Request, *iam.DeleteUserPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteUserPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteUserPolicyOutput) + return ret0, ret1 +} + +// DeleteUserPolicyRequest indicates an expected call of DeleteUserPolicyRequest. +func (mr *MockIAMAPIMockRecorder) DeleteUserPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserPolicyRequest), arg0) +} + +// DeleteUserPolicyWithContext mocks base method. +func (m *MockIAMAPI) DeleteUserPolicyWithContext(arg0 aws.Context, arg1 *iam.DeleteUserPolicyInput, arg2 ...request.Option) (*iam.DeleteUserPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteUserPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteUserPolicyWithContext indicates an expected call of DeleteUserPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteUserPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserPolicyWithContext), varargs...) +} + +// DeleteUserRequest mocks base method. +func (m *MockIAMAPI) DeleteUserRequest(arg0 *iam.DeleteUserInput) (*request.Request, *iam.DeleteUserOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteUserRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteUserOutput) + return ret0, ret1 +} + +// DeleteUserRequest indicates an expected call of DeleteUserRequest. +func (mr *MockIAMAPIMockRecorder) DeleteUserRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserRequest), arg0) +} + +// DeleteUserWithContext mocks base method. +func (m *MockIAMAPI) DeleteUserWithContext(arg0 aws.Context, arg1 *iam.DeleteUserInput, arg2 ...request.Option) (*iam.DeleteUserOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteUserWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteUserWithContext indicates an expected call of DeleteUserWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteUserWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUserWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteUserWithContext), varargs...) +} + +// DeleteVirtualMFADevice mocks base method. +func (m *MockIAMAPI) DeleteVirtualMFADevice(arg0 *iam.DeleteVirtualMFADeviceInput) (*iam.DeleteVirtualMFADeviceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteVirtualMFADevice", arg0) + ret0, _ := ret[0].(*iam.DeleteVirtualMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteVirtualMFADevice indicates an expected call of DeleteVirtualMFADevice. +func (mr *MockIAMAPIMockRecorder) DeleteVirtualMFADevice(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteVirtualMFADevice", reflect.TypeOf((*MockIAMAPI)(nil).DeleteVirtualMFADevice), arg0) +} + +// DeleteVirtualMFADeviceRequest mocks base method. +func (m *MockIAMAPI) DeleteVirtualMFADeviceRequest(arg0 *iam.DeleteVirtualMFADeviceInput) (*request.Request, *iam.DeleteVirtualMFADeviceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteVirtualMFADeviceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DeleteVirtualMFADeviceOutput) + return ret0, ret1 +} + +// DeleteVirtualMFADeviceRequest indicates an expected call of DeleteVirtualMFADeviceRequest. +func (mr *MockIAMAPIMockRecorder) DeleteVirtualMFADeviceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteVirtualMFADeviceRequest", reflect.TypeOf((*MockIAMAPI)(nil).DeleteVirtualMFADeviceRequest), arg0) +} + +// DeleteVirtualMFADeviceWithContext mocks base method. +func (m *MockIAMAPI) DeleteVirtualMFADeviceWithContext(arg0 aws.Context, arg1 *iam.DeleteVirtualMFADeviceInput, arg2 ...request.Option) (*iam.DeleteVirtualMFADeviceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteVirtualMFADeviceWithContext", varargs...) + ret0, _ := ret[0].(*iam.DeleteVirtualMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteVirtualMFADeviceWithContext indicates an expected call of DeleteVirtualMFADeviceWithContext. +func (mr *MockIAMAPIMockRecorder) DeleteVirtualMFADeviceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteVirtualMFADeviceWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DeleteVirtualMFADeviceWithContext), varargs...) +} + +// DetachGroupPolicy mocks base method. +func (m *MockIAMAPI) DetachGroupPolicy(arg0 *iam.DetachGroupPolicyInput) (*iam.DetachGroupPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetachGroupPolicy", arg0) + ret0, _ := ret[0].(*iam.DetachGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetachGroupPolicy indicates an expected call of DetachGroupPolicy. +func (mr *MockIAMAPIMockRecorder) DetachGroupPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachGroupPolicy", reflect.TypeOf((*MockIAMAPI)(nil).DetachGroupPolicy), arg0) +} + +// DetachGroupPolicyRequest mocks base method. +func (m *MockIAMAPI) DetachGroupPolicyRequest(arg0 *iam.DetachGroupPolicyInput) (*request.Request, *iam.DetachGroupPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetachGroupPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DetachGroupPolicyOutput) + return ret0, ret1 +} + +// DetachGroupPolicyRequest indicates an expected call of DetachGroupPolicyRequest. +func (mr *MockIAMAPIMockRecorder) DetachGroupPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachGroupPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DetachGroupPolicyRequest), arg0) +} + +// DetachGroupPolicyWithContext mocks base method. +func (m *MockIAMAPI) DetachGroupPolicyWithContext(arg0 aws.Context, arg1 *iam.DetachGroupPolicyInput, arg2 ...request.Option) (*iam.DetachGroupPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DetachGroupPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DetachGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetachGroupPolicyWithContext indicates an expected call of DetachGroupPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DetachGroupPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachGroupPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DetachGroupPolicyWithContext), varargs...) +} + +// DetachRolePolicy mocks base method. +func (m *MockIAMAPI) DetachRolePolicy(arg0 *iam.DetachRolePolicyInput) (*iam.DetachRolePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetachRolePolicy", arg0) + ret0, _ := ret[0].(*iam.DetachRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetachRolePolicy indicates an expected call of DetachRolePolicy. +func (mr *MockIAMAPIMockRecorder) DetachRolePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachRolePolicy", reflect.TypeOf((*MockIAMAPI)(nil).DetachRolePolicy), arg0) +} + +// DetachRolePolicyRequest mocks base method. +func (m *MockIAMAPI) DetachRolePolicyRequest(arg0 *iam.DetachRolePolicyInput) (*request.Request, *iam.DetachRolePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetachRolePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DetachRolePolicyOutput) + return ret0, ret1 +} + +// DetachRolePolicyRequest indicates an expected call of DetachRolePolicyRequest. +func (mr *MockIAMAPIMockRecorder) DetachRolePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachRolePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DetachRolePolicyRequest), arg0) +} + +// DetachRolePolicyWithContext mocks base method. +func (m *MockIAMAPI) DetachRolePolicyWithContext(arg0 aws.Context, arg1 *iam.DetachRolePolicyInput, arg2 ...request.Option) (*iam.DetachRolePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DetachRolePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DetachRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetachRolePolicyWithContext indicates an expected call of DetachRolePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DetachRolePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachRolePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DetachRolePolicyWithContext), varargs...) +} + +// DetachUserPolicy mocks base method. +func (m *MockIAMAPI) DetachUserPolicy(arg0 *iam.DetachUserPolicyInput) (*iam.DetachUserPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetachUserPolicy", arg0) + ret0, _ := ret[0].(*iam.DetachUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetachUserPolicy indicates an expected call of DetachUserPolicy. +func (mr *MockIAMAPIMockRecorder) DetachUserPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachUserPolicy", reflect.TypeOf((*MockIAMAPI)(nil).DetachUserPolicy), arg0) +} + +// DetachUserPolicyRequest mocks base method. +func (m *MockIAMAPI) DetachUserPolicyRequest(arg0 *iam.DetachUserPolicyInput) (*request.Request, *iam.DetachUserPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DetachUserPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.DetachUserPolicyOutput) + return ret0, ret1 +} + +// DetachUserPolicyRequest indicates an expected call of DetachUserPolicyRequest. +func (mr *MockIAMAPIMockRecorder) DetachUserPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachUserPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).DetachUserPolicyRequest), arg0) +} + +// DetachUserPolicyWithContext mocks base method. +func (m *MockIAMAPI) DetachUserPolicyWithContext(arg0 aws.Context, arg1 *iam.DetachUserPolicyInput, arg2 ...request.Option) (*iam.DetachUserPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DetachUserPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.DetachUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DetachUserPolicyWithContext indicates an expected call of DetachUserPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) DetachUserPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DetachUserPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).DetachUserPolicyWithContext), varargs...) +} + +// EnableMFADevice mocks base method. +func (m *MockIAMAPI) EnableMFADevice(arg0 *iam.EnableMFADeviceInput) (*iam.EnableMFADeviceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EnableMFADevice", arg0) + ret0, _ := ret[0].(*iam.EnableMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EnableMFADevice indicates an expected call of EnableMFADevice. +func (mr *MockIAMAPIMockRecorder) EnableMFADevice(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnableMFADevice", reflect.TypeOf((*MockIAMAPI)(nil).EnableMFADevice), arg0) +} + +// EnableMFADeviceRequest mocks base method. +func (m *MockIAMAPI) EnableMFADeviceRequest(arg0 *iam.EnableMFADeviceInput) (*request.Request, *iam.EnableMFADeviceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EnableMFADeviceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.EnableMFADeviceOutput) + return ret0, ret1 +} + +// EnableMFADeviceRequest indicates an expected call of EnableMFADeviceRequest. +func (mr *MockIAMAPIMockRecorder) EnableMFADeviceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnableMFADeviceRequest", reflect.TypeOf((*MockIAMAPI)(nil).EnableMFADeviceRequest), arg0) +} + +// EnableMFADeviceWithContext mocks base method. +func (m *MockIAMAPI) EnableMFADeviceWithContext(arg0 aws.Context, arg1 *iam.EnableMFADeviceInput, arg2 ...request.Option) (*iam.EnableMFADeviceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "EnableMFADeviceWithContext", varargs...) + ret0, _ := ret[0].(*iam.EnableMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EnableMFADeviceWithContext indicates an expected call of EnableMFADeviceWithContext. +func (mr *MockIAMAPIMockRecorder) EnableMFADeviceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnableMFADeviceWithContext", reflect.TypeOf((*MockIAMAPI)(nil).EnableMFADeviceWithContext), varargs...) +} + +// GenerateCredentialReport mocks base method. +func (m *MockIAMAPI) GenerateCredentialReport(arg0 *iam.GenerateCredentialReportInput) (*iam.GenerateCredentialReportOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateCredentialReport", arg0) + ret0, _ := ret[0].(*iam.GenerateCredentialReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateCredentialReport indicates an expected call of GenerateCredentialReport. +func (mr *MockIAMAPIMockRecorder) GenerateCredentialReport(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateCredentialReport", reflect.TypeOf((*MockIAMAPI)(nil).GenerateCredentialReport), arg0) +} + +// GenerateCredentialReportRequest mocks base method. +func (m *MockIAMAPI) GenerateCredentialReportRequest(arg0 *iam.GenerateCredentialReportInput) (*request.Request, *iam.GenerateCredentialReportOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateCredentialReportRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GenerateCredentialReportOutput) + return ret0, ret1 +} + +// GenerateCredentialReportRequest indicates an expected call of GenerateCredentialReportRequest. +func (mr *MockIAMAPIMockRecorder) GenerateCredentialReportRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateCredentialReportRequest", reflect.TypeOf((*MockIAMAPI)(nil).GenerateCredentialReportRequest), arg0) +} + +// GenerateCredentialReportWithContext mocks base method. +func (m *MockIAMAPI) GenerateCredentialReportWithContext(arg0 aws.Context, arg1 *iam.GenerateCredentialReportInput, arg2 ...request.Option) (*iam.GenerateCredentialReportOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GenerateCredentialReportWithContext", varargs...) + ret0, _ := ret[0].(*iam.GenerateCredentialReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateCredentialReportWithContext indicates an expected call of GenerateCredentialReportWithContext. +func (mr *MockIAMAPIMockRecorder) GenerateCredentialReportWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateCredentialReportWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GenerateCredentialReportWithContext), varargs...) +} + +// GenerateOrganizationsAccessReport mocks base method. +func (m *MockIAMAPI) GenerateOrganizationsAccessReport(arg0 *iam.GenerateOrganizationsAccessReportInput) (*iam.GenerateOrganizationsAccessReportOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateOrganizationsAccessReport", arg0) + ret0, _ := ret[0].(*iam.GenerateOrganizationsAccessReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateOrganizationsAccessReport indicates an expected call of GenerateOrganizationsAccessReport. +func (mr *MockIAMAPIMockRecorder) GenerateOrganizationsAccessReport(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateOrganizationsAccessReport", reflect.TypeOf((*MockIAMAPI)(nil).GenerateOrganizationsAccessReport), arg0) +} + +// GenerateOrganizationsAccessReportRequest mocks base method. +func (m *MockIAMAPI) GenerateOrganizationsAccessReportRequest(arg0 *iam.GenerateOrganizationsAccessReportInput) (*request.Request, *iam.GenerateOrganizationsAccessReportOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateOrganizationsAccessReportRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GenerateOrganizationsAccessReportOutput) + return ret0, ret1 +} + +// GenerateOrganizationsAccessReportRequest indicates an expected call of GenerateOrganizationsAccessReportRequest. +func (mr *MockIAMAPIMockRecorder) GenerateOrganizationsAccessReportRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateOrganizationsAccessReportRequest", reflect.TypeOf((*MockIAMAPI)(nil).GenerateOrganizationsAccessReportRequest), arg0) +} + +// GenerateOrganizationsAccessReportWithContext mocks base method. +func (m *MockIAMAPI) GenerateOrganizationsAccessReportWithContext(arg0 aws.Context, arg1 *iam.GenerateOrganizationsAccessReportInput, arg2 ...request.Option) (*iam.GenerateOrganizationsAccessReportOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GenerateOrganizationsAccessReportWithContext", varargs...) + ret0, _ := ret[0].(*iam.GenerateOrganizationsAccessReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateOrganizationsAccessReportWithContext indicates an expected call of GenerateOrganizationsAccessReportWithContext. +func (mr *MockIAMAPIMockRecorder) GenerateOrganizationsAccessReportWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateOrganizationsAccessReportWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GenerateOrganizationsAccessReportWithContext), varargs...) +} + +// GenerateServiceLastAccessedDetails mocks base method. +func (m *MockIAMAPI) GenerateServiceLastAccessedDetails(arg0 *iam.GenerateServiceLastAccessedDetailsInput) (*iam.GenerateServiceLastAccessedDetailsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateServiceLastAccessedDetails", arg0) + ret0, _ := ret[0].(*iam.GenerateServiceLastAccessedDetailsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateServiceLastAccessedDetails indicates an expected call of GenerateServiceLastAccessedDetails. +func (mr *MockIAMAPIMockRecorder) GenerateServiceLastAccessedDetails(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateServiceLastAccessedDetails", reflect.TypeOf((*MockIAMAPI)(nil).GenerateServiceLastAccessedDetails), arg0) +} + +// GenerateServiceLastAccessedDetailsRequest mocks base method. +func (m *MockIAMAPI) GenerateServiceLastAccessedDetailsRequest(arg0 *iam.GenerateServiceLastAccessedDetailsInput) (*request.Request, *iam.GenerateServiceLastAccessedDetailsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateServiceLastAccessedDetailsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GenerateServiceLastAccessedDetailsOutput) + return ret0, ret1 +} + +// GenerateServiceLastAccessedDetailsRequest indicates an expected call of GenerateServiceLastAccessedDetailsRequest. +func (mr *MockIAMAPIMockRecorder) GenerateServiceLastAccessedDetailsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateServiceLastAccessedDetailsRequest", reflect.TypeOf((*MockIAMAPI)(nil).GenerateServiceLastAccessedDetailsRequest), arg0) +} + +// GenerateServiceLastAccessedDetailsWithContext mocks base method. +func (m *MockIAMAPI) GenerateServiceLastAccessedDetailsWithContext(arg0 aws.Context, arg1 *iam.GenerateServiceLastAccessedDetailsInput, arg2 ...request.Option) (*iam.GenerateServiceLastAccessedDetailsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GenerateServiceLastAccessedDetailsWithContext", varargs...) + ret0, _ := ret[0].(*iam.GenerateServiceLastAccessedDetailsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateServiceLastAccessedDetailsWithContext indicates an expected call of GenerateServiceLastAccessedDetailsWithContext. +func (mr *MockIAMAPIMockRecorder) GenerateServiceLastAccessedDetailsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateServiceLastAccessedDetailsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GenerateServiceLastAccessedDetailsWithContext), varargs...) +} + +// GetAccessKeyLastUsed mocks base method. +func (m *MockIAMAPI) GetAccessKeyLastUsed(arg0 *iam.GetAccessKeyLastUsedInput) (*iam.GetAccessKeyLastUsedOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccessKeyLastUsed", arg0) + ret0, _ := ret[0].(*iam.GetAccessKeyLastUsedOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccessKeyLastUsed indicates an expected call of GetAccessKeyLastUsed. +func (mr *MockIAMAPIMockRecorder) GetAccessKeyLastUsed(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccessKeyLastUsed", reflect.TypeOf((*MockIAMAPI)(nil).GetAccessKeyLastUsed), arg0) +} + +// GetAccessKeyLastUsedRequest mocks base method. +func (m *MockIAMAPI) GetAccessKeyLastUsedRequest(arg0 *iam.GetAccessKeyLastUsedInput) (*request.Request, *iam.GetAccessKeyLastUsedOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccessKeyLastUsedRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetAccessKeyLastUsedOutput) + return ret0, ret1 +} + +// GetAccessKeyLastUsedRequest indicates an expected call of GetAccessKeyLastUsedRequest. +func (mr *MockIAMAPIMockRecorder) GetAccessKeyLastUsedRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccessKeyLastUsedRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetAccessKeyLastUsedRequest), arg0) +} + +// GetAccessKeyLastUsedWithContext mocks base method. +func (m *MockIAMAPI) GetAccessKeyLastUsedWithContext(arg0 aws.Context, arg1 *iam.GetAccessKeyLastUsedInput, arg2 ...request.Option) (*iam.GetAccessKeyLastUsedOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetAccessKeyLastUsedWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetAccessKeyLastUsedOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccessKeyLastUsedWithContext indicates an expected call of GetAccessKeyLastUsedWithContext. +func (mr *MockIAMAPIMockRecorder) GetAccessKeyLastUsedWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccessKeyLastUsedWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetAccessKeyLastUsedWithContext), varargs...) +} + +// GetAccountAuthorizationDetails mocks base method. +func (m *MockIAMAPI) GetAccountAuthorizationDetails(arg0 *iam.GetAccountAuthorizationDetailsInput) (*iam.GetAccountAuthorizationDetailsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountAuthorizationDetails", arg0) + ret0, _ := ret[0].(*iam.GetAccountAuthorizationDetailsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccountAuthorizationDetails indicates an expected call of GetAccountAuthorizationDetails. +func (mr *MockIAMAPIMockRecorder) GetAccountAuthorizationDetails(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountAuthorizationDetails", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountAuthorizationDetails), arg0) +} + +// GetAccountAuthorizationDetailsPages mocks base method. +func (m *MockIAMAPI) GetAccountAuthorizationDetailsPages(arg0 *iam.GetAccountAuthorizationDetailsInput, arg1 func(*iam.GetAccountAuthorizationDetailsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountAuthorizationDetailsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// GetAccountAuthorizationDetailsPages indicates an expected call of GetAccountAuthorizationDetailsPages. +func (mr *MockIAMAPIMockRecorder) GetAccountAuthorizationDetailsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountAuthorizationDetailsPages", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountAuthorizationDetailsPages), arg0, arg1) +} + +// GetAccountAuthorizationDetailsPagesWithContext mocks base method. +func (m *MockIAMAPI) GetAccountAuthorizationDetailsPagesWithContext(arg0 aws.Context, arg1 *iam.GetAccountAuthorizationDetailsInput, arg2 func(*iam.GetAccountAuthorizationDetailsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetAccountAuthorizationDetailsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// GetAccountAuthorizationDetailsPagesWithContext indicates an expected call of GetAccountAuthorizationDetailsPagesWithContext. +func (mr *MockIAMAPIMockRecorder) GetAccountAuthorizationDetailsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountAuthorizationDetailsPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountAuthorizationDetailsPagesWithContext), varargs...) +} + +// GetAccountAuthorizationDetailsRequest mocks base method. +func (m *MockIAMAPI) GetAccountAuthorizationDetailsRequest(arg0 *iam.GetAccountAuthorizationDetailsInput) (*request.Request, *iam.GetAccountAuthorizationDetailsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountAuthorizationDetailsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetAccountAuthorizationDetailsOutput) + return ret0, ret1 +} + +// GetAccountAuthorizationDetailsRequest indicates an expected call of GetAccountAuthorizationDetailsRequest. +func (mr *MockIAMAPIMockRecorder) GetAccountAuthorizationDetailsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountAuthorizationDetailsRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountAuthorizationDetailsRequest), arg0) +} + +// GetAccountAuthorizationDetailsWithContext mocks base method. +func (m *MockIAMAPI) GetAccountAuthorizationDetailsWithContext(arg0 aws.Context, arg1 *iam.GetAccountAuthorizationDetailsInput, arg2 ...request.Option) (*iam.GetAccountAuthorizationDetailsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetAccountAuthorizationDetailsWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetAccountAuthorizationDetailsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccountAuthorizationDetailsWithContext indicates an expected call of GetAccountAuthorizationDetailsWithContext. +func (mr *MockIAMAPIMockRecorder) GetAccountAuthorizationDetailsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountAuthorizationDetailsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountAuthorizationDetailsWithContext), varargs...) +} + +// GetAccountPasswordPolicy mocks base method. +func (m *MockIAMAPI) GetAccountPasswordPolicy(arg0 *iam.GetAccountPasswordPolicyInput) (*iam.GetAccountPasswordPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountPasswordPolicy", arg0) + ret0, _ := ret[0].(*iam.GetAccountPasswordPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccountPasswordPolicy indicates an expected call of GetAccountPasswordPolicy. +func (mr *MockIAMAPIMockRecorder) GetAccountPasswordPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountPasswordPolicy", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountPasswordPolicy), arg0) +} + +// GetAccountPasswordPolicyRequest mocks base method. +func (m *MockIAMAPI) GetAccountPasswordPolicyRequest(arg0 *iam.GetAccountPasswordPolicyInput) (*request.Request, *iam.GetAccountPasswordPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountPasswordPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetAccountPasswordPolicyOutput) + return ret0, ret1 +} + +// GetAccountPasswordPolicyRequest indicates an expected call of GetAccountPasswordPolicyRequest. +func (mr *MockIAMAPIMockRecorder) GetAccountPasswordPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountPasswordPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountPasswordPolicyRequest), arg0) +} + +// GetAccountPasswordPolicyWithContext mocks base method. +func (m *MockIAMAPI) GetAccountPasswordPolicyWithContext(arg0 aws.Context, arg1 *iam.GetAccountPasswordPolicyInput, arg2 ...request.Option) (*iam.GetAccountPasswordPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetAccountPasswordPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetAccountPasswordPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccountPasswordPolicyWithContext indicates an expected call of GetAccountPasswordPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) GetAccountPasswordPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountPasswordPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountPasswordPolicyWithContext), varargs...) +} + +// GetAccountSummary mocks base method. +func (m *MockIAMAPI) GetAccountSummary(arg0 *iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountSummary", arg0) + ret0, _ := ret[0].(*iam.GetAccountSummaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccountSummary indicates an expected call of GetAccountSummary. +func (mr *MockIAMAPIMockRecorder) GetAccountSummary(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountSummary", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountSummary), arg0) +} + +// GetAccountSummaryRequest mocks base method. +func (m *MockIAMAPI) GetAccountSummaryRequest(arg0 *iam.GetAccountSummaryInput) (*request.Request, *iam.GetAccountSummaryOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccountSummaryRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetAccountSummaryOutput) + return ret0, ret1 +} + +// GetAccountSummaryRequest indicates an expected call of GetAccountSummaryRequest. +func (mr *MockIAMAPIMockRecorder) GetAccountSummaryRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountSummaryRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountSummaryRequest), arg0) +} + +// GetAccountSummaryWithContext mocks base method. +func (m *MockIAMAPI) GetAccountSummaryWithContext(arg0 aws.Context, arg1 *iam.GetAccountSummaryInput, arg2 ...request.Option) (*iam.GetAccountSummaryOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetAccountSummaryWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetAccountSummaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetAccountSummaryWithContext indicates an expected call of GetAccountSummaryWithContext. +func (mr *MockIAMAPIMockRecorder) GetAccountSummaryWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountSummaryWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetAccountSummaryWithContext), varargs...) +} + +// GetContextKeysForCustomPolicy mocks base method. +func (m *MockIAMAPI) GetContextKeysForCustomPolicy(arg0 *iam.GetContextKeysForCustomPolicyInput) (*iam.GetContextKeysForPolicyResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetContextKeysForCustomPolicy", arg0) + ret0, _ := ret[0].(*iam.GetContextKeysForPolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetContextKeysForCustomPolicy indicates an expected call of GetContextKeysForCustomPolicy. +func (mr *MockIAMAPIMockRecorder) GetContextKeysForCustomPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContextKeysForCustomPolicy", reflect.TypeOf((*MockIAMAPI)(nil).GetContextKeysForCustomPolicy), arg0) +} + +// GetContextKeysForCustomPolicyRequest mocks base method. +func (m *MockIAMAPI) GetContextKeysForCustomPolicyRequest(arg0 *iam.GetContextKeysForCustomPolicyInput) (*request.Request, *iam.GetContextKeysForPolicyResponse) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetContextKeysForCustomPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetContextKeysForPolicyResponse) + return ret0, ret1 +} + +// GetContextKeysForCustomPolicyRequest indicates an expected call of GetContextKeysForCustomPolicyRequest. +func (mr *MockIAMAPIMockRecorder) GetContextKeysForCustomPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContextKeysForCustomPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetContextKeysForCustomPolicyRequest), arg0) +} + +// GetContextKeysForCustomPolicyWithContext mocks base method. +func (m *MockIAMAPI) GetContextKeysForCustomPolicyWithContext(arg0 aws.Context, arg1 *iam.GetContextKeysForCustomPolicyInput, arg2 ...request.Option) (*iam.GetContextKeysForPolicyResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetContextKeysForCustomPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetContextKeysForPolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetContextKeysForCustomPolicyWithContext indicates an expected call of GetContextKeysForCustomPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) GetContextKeysForCustomPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContextKeysForCustomPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetContextKeysForCustomPolicyWithContext), varargs...) +} + +// GetContextKeysForPrincipalPolicy mocks base method. +func (m *MockIAMAPI) GetContextKeysForPrincipalPolicy(arg0 *iam.GetContextKeysForPrincipalPolicyInput) (*iam.GetContextKeysForPolicyResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetContextKeysForPrincipalPolicy", arg0) + ret0, _ := ret[0].(*iam.GetContextKeysForPolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetContextKeysForPrincipalPolicy indicates an expected call of GetContextKeysForPrincipalPolicy. +func (mr *MockIAMAPIMockRecorder) GetContextKeysForPrincipalPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContextKeysForPrincipalPolicy", reflect.TypeOf((*MockIAMAPI)(nil).GetContextKeysForPrincipalPolicy), arg0) +} + +// GetContextKeysForPrincipalPolicyRequest mocks base method. +func (m *MockIAMAPI) GetContextKeysForPrincipalPolicyRequest(arg0 *iam.GetContextKeysForPrincipalPolicyInput) (*request.Request, *iam.GetContextKeysForPolicyResponse) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetContextKeysForPrincipalPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetContextKeysForPolicyResponse) + return ret0, ret1 +} + +// GetContextKeysForPrincipalPolicyRequest indicates an expected call of GetContextKeysForPrincipalPolicyRequest. +func (mr *MockIAMAPIMockRecorder) GetContextKeysForPrincipalPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContextKeysForPrincipalPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetContextKeysForPrincipalPolicyRequest), arg0) +} + +// GetContextKeysForPrincipalPolicyWithContext mocks base method. +func (m *MockIAMAPI) GetContextKeysForPrincipalPolicyWithContext(arg0 aws.Context, arg1 *iam.GetContextKeysForPrincipalPolicyInput, arg2 ...request.Option) (*iam.GetContextKeysForPolicyResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetContextKeysForPrincipalPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetContextKeysForPolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetContextKeysForPrincipalPolicyWithContext indicates an expected call of GetContextKeysForPrincipalPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) GetContextKeysForPrincipalPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContextKeysForPrincipalPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetContextKeysForPrincipalPolicyWithContext), varargs...) +} + +// GetCredentialReport mocks base method. +func (m *MockIAMAPI) GetCredentialReport(arg0 *iam.GetCredentialReportInput) (*iam.GetCredentialReportOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCredentialReport", arg0) + ret0, _ := ret[0].(*iam.GetCredentialReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCredentialReport indicates an expected call of GetCredentialReport. +func (mr *MockIAMAPIMockRecorder) GetCredentialReport(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCredentialReport", reflect.TypeOf((*MockIAMAPI)(nil).GetCredentialReport), arg0) +} + +// GetCredentialReportRequest mocks base method. +func (m *MockIAMAPI) GetCredentialReportRequest(arg0 *iam.GetCredentialReportInput) (*request.Request, *iam.GetCredentialReportOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCredentialReportRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetCredentialReportOutput) + return ret0, ret1 +} + +// GetCredentialReportRequest indicates an expected call of GetCredentialReportRequest. +func (mr *MockIAMAPIMockRecorder) GetCredentialReportRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCredentialReportRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetCredentialReportRequest), arg0) +} + +// GetCredentialReportWithContext mocks base method. +func (m *MockIAMAPI) GetCredentialReportWithContext(arg0 aws.Context, arg1 *iam.GetCredentialReportInput, arg2 ...request.Option) (*iam.GetCredentialReportOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetCredentialReportWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetCredentialReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCredentialReportWithContext indicates an expected call of GetCredentialReportWithContext. +func (mr *MockIAMAPIMockRecorder) GetCredentialReportWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCredentialReportWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetCredentialReportWithContext), varargs...) +} + +// GetGroup mocks base method. +func (m *MockIAMAPI) GetGroup(arg0 *iam.GetGroupInput) (*iam.GetGroupOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroup", arg0) + ret0, _ := ret[0].(*iam.GetGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGroup indicates an expected call of GetGroup. +func (mr *MockIAMAPIMockRecorder) GetGroup(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroup", reflect.TypeOf((*MockIAMAPI)(nil).GetGroup), arg0) +} + +// GetGroupPages mocks base method. +func (m *MockIAMAPI) GetGroupPages(arg0 *iam.GetGroupInput, arg1 func(*iam.GetGroupOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// GetGroupPages indicates an expected call of GetGroupPages. +func (mr *MockIAMAPIMockRecorder) GetGroupPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupPages", reflect.TypeOf((*MockIAMAPI)(nil).GetGroupPages), arg0, arg1) +} + +// GetGroupPagesWithContext mocks base method. +func (m *MockIAMAPI) GetGroupPagesWithContext(arg0 aws.Context, arg1 *iam.GetGroupInput, arg2 func(*iam.GetGroupOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetGroupPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// GetGroupPagesWithContext indicates an expected call of GetGroupPagesWithContext. +func (mr *MockIAMAPIMockRecorder) GetGroupPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetGroupPagesWithContext), varargs...) +} + +// GetGroupPolicy mocks base method. +func (m *MockIAMAPI) GetGroupPolicy(arg0 *iam.GetGroupPolicyInput) (*iam.GetGroupPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupPolicy", arg0) + ret0, _ := ret[0].(*iam.GetGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGroupPolicy indicates an expected call of GetGroupPolicy. +func (mr *MockIAMAPIMockRecorder) GetGroupPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupPolicy", reflect.TypeOf((*MockIAMAPI)(nil).GetGroupPolicy), arg0) +} + +// GetGroupPolicyRequest mocks base method. +func (m *MockIAMAPI) GetGroupPolicyRequest(arg0 *iam.GetGroupPolicyInput) (*request.Request, *iam.GetGroupPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetGroupPolicyOutput) + return ret0, ret1 +} + +// GetGroupPolicyRequest indicates an expected call of GetGroupPolicyRequest. +func (mr *MockIAMAPIMockRecorder) GetGroupPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetGroupPolicyRequest), arg0) +} + +// GetGroupPolicyWithContext mocks base method. +func (m *MockIAMAPI) GetGroupPolicyWithContext(arg0 aws.Context, arg1 *iam.GetGroupPolicyInput, arg2 ...request.Option) (*iam.GetGroupPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetGroupPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGroupPolicyWithContext indicates an expected call of GetGroupPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) GetGroupPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetGroupPolicyWithContext), varargs...) +} + +// GetGroupRequest mocks base method. +func (m *MockIAMAPI) GetGroupRequest(arg0 *iam.GetGroupInput) (*request.Request, *iam.GetGroupOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetGroupOutput) + return ret0, ret1 +} + +// GetGroupRequest indicates an expected call of GetGroupRequest. +func (mr *MockIAMAPIMockRecorder) GetGroupRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetGroupRequest), arg0) +} + +// GetGroupWithContext mocks base method. +func (m *MockIAMAPI) GetGroupWithContext(arg0 aws.Context, arg1 *iam.GetGroupInput, arg2 ...request.Option) (*iam.GetGroupOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetGroupWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetGroupWithContext indicates an expected call of GetGroupWithContext. +func (mr *MockIAMAPIMockRecorder) GetGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetGroupWithContext), varargs...) +} + +// GetInstanceProfile mocks base method. +func (m *MockIAMAPI) GetInstanceProfile(arg0 *iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetInstanceProfile", arg0) + ret0, _ := ret[0].(*iam.GetInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetInstanceProfile indicates an expected call of GetInstanceProfile. +func (mr *MockIAMAPIMockRecorder) GetInstanceProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceProfile", reflect.TypeOf((*MockIAMAPI)(nil).GetInstanceProfile), arg0) +} + +// GetInstanceProfileRequest mocks base method. +func (m *MockIAMAPI) GetInstanceProfileRequest(arg0 *iam.GetInstanceProfileInput) (*request.Request, *iam.GetInstanceProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetInstanceProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetInstanceProfileOutput) + return ret0, ret1 +} + +// GetInstanceProfileRequest indicates an expected call of GetInstanceProfileRequest. +func (mr *MockIAMAPIMockRecorder) GetInstanceProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetInstanceProfileRequest), arg0) +} + +// GetInstanceProfileWithContext mocks base method. +func (m *MockIAMAPI) GetInstanceProfileWithContext(arg0 aws.Context, arg1 *iam.GetInstanceProfileInput, arg2 ...request.Option) (*iam.GetInstanceProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetInstanceProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetInstanceProfileWithContext indicates an expected call of GetInstanceProfileWithContext. +func (mr *MockIAMAPIMockRecorder) GetInstanceProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetInstanceProfileWithContext), varargs...) +} + +// GetLoginProfile mocks base method. +func (m *MockIAMAPI) GetLoginProfile(arg0 *iam.GetLoginProfileInput) (*iam.GetLoginProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLoginProfile", arg0) + ret0, _ := ret[0].(*iam.GetLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetLoginProfile indicates an expected call of GetLoginProfile. +func (mr *MockIAMAPIMockRecorder) GetLoginProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoginProfile", reflect.TypeOf((*MockIAMAPI)(nil).GetLoginProfile), arg0) +} + +// GetLoginProfileRequest mocks base method. +func (m *MockIAMAPI) GetLoginProfileRequest(arg0 *iam.GetLoginProfileInput) (*request.Request, *iam.GetLoginProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLoginProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetLoginProfileOutput) + return ret0, ret1 +} + +// GetLoginProfileRequest indicates an expected call of GetLoginProfileRequest. +func (mr *MockIAMAPIMockRecorder) GetLoginProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoginProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetLoginProfileRequest), arg0) +} + +// GetLoginProfileWithContext mocks base method. +func (m *MockIAMAPI) GetLoginProfileWithContext(arg0 aws.Context, arg1 *iam.GetLoginProfileInput, arg2 ...request.Option) (*iam.GetLoginProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetLoginProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetLoginProfileWithContext indicates an expected call of GetLoginProfileWithContext. +func (mr *MockIAMAPIMockRecorder) GetLoginProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoginProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetLoginProfileWithContext), varargs...) +} + +// GetOpenIDConnectProvider mocks base method. +func (m *MockIAMAPI) GetOpenIDConnectProvider(arg0 *iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOpenIDConnectProvider", arg0) + ret0, _ := ret[0].(*iam.GetOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetOpenIDConnectProvider indicates an expected call of GetOpenIDConnectProvider. +func (mr *MockIAMAPIMockRecorder) GetOpenIDConnectProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOpenIDConnectProvider", reflect.TypeOf((*MockIAMAPI)(nil).GetOpenIDConnectProvider), arg0) +} + +// GetOpenIDConnectProviderRequest mocks base method. +func (m *MockIAMAPI) GetOpenIDConnectProviderRequest(arg0 *iam.GetOpenIDConnectProviderInput) (*request.Request, *iam.GetOpenIDConnectProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOpenIDConnectProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetOpenIDConnectProviderOutput) + return ret0, ret1 +} + +// GetOpenIDConnectProviderRequest indicates an expected call of GetOpenIDConnectProviderRequest. +func (mr *MockIAMAPIMockRecorder) GetOpenIDConnectProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOpenIDConnectProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetOpenIDConnectProviderRequest), arg0) +} + +// GetOpenIDConnectProviderWithContext mocks base method. +func (m *MockIAMAPI) GetOpenIDConnectProviderWithContext(arg0 aws.Context, arg1 *iam.GetOpenIDConnectProviderInput, arg2 ...request.Option) (*iam.GetOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetOpenIDConnectProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetOpenIDConnectProviderWithContext indicates an expected call of GetOpenIDConnectProviderWithContext. +func (mr *MockIAMAPIMockRecorder) GetOpenIDConnectProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOpenIDConnectProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetOpenIDConnectProviderWithContext), varargs...) +} + +// GetOrganizationsAccessReport mocks base method. +func (m *MockIAMAPI) GetOrganizationsAccessReport(arg0 *iam.GetOrganizationsAccessReportInput) (*iam.GetOrganizationsAccessReportOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOrganizationsAccessReport", arg0) + ret0, _ := ret[0].(*iam.GetOrganizationsAccessReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetOrganizationsAccessReport indicates an expected call of GetOrganizationsAccessReport. +func (mr *MockIAMAPIMockRecorder) GetOrganizationsAccessReport(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationsAccessReport", reflect.TypeOf((*MockIAMAPI)(nil).GetOrganizationsAccessReport), arg0) +} + +// GetOrganizationsAccessReportRequest mocks base method. +func (m *MockIAMAPI) GetOrganizationsAccessReportRequest(arg0 *iam.GetOrganizationsAccessReportInput) (*request.Request, *iam.GetOrganizationsAccessReportOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOrganizationsAccessReportRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetOrganizationsAccessReportOutput) + return ret0, ret1 +} + +// GetOrganizationsAccessReportRequest indicates an expected call of GetOrganizationsAccessReportRequest. +func (mr *MockIAMAPIMockRecorder) GetOrganizationsAccessReportRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationsAccessReportRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetOrganizationsAccessReportRequest), arg0) +} + +// GetOrganizationsAccessReportWithContext mocks base method. +func (m *MockIAMAPI) GetOrganizationsAccessReportWithContext(arg0 aws.Context, arg1 *iam.GetOrganizationsAccessReportInput, arg2 ...request.Option) (*iam.GetOrganizationsAccessReportOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetOrganizationsAccessReportWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetOrganizationsAccessReportOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetOrganizationsAccessReportWithContext indicates an expected call of GetOrganizationsAccessReportWithContext. +func (mr *MockIAMAPIMockRecorder) GetOrganizationsAccessReportWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationsAccessReportWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetOrganizationsAccessReportWithContext), varargs...) +} + +// GetPolicy mocks base method. +func (m *MockIAMAPI) GetPolicy(arg0 *iam.GetPolicyInput) (*iam.GetPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPolicy", arg0) + ret0, _ := ret[0].(*iam.GetPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicy indicates an expected call of GetPolicy. +func (mr *MockIAMAPIMockRecorder) GetPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicy", reflect.TypeOf((*MockIAMAPI)(nil).GetPolicy), arg0) +} + +// GetPolicyRequest mocks base method. +func (m *MockIAMAPI) GetPolicyRequest(arg0 *iam.GetPolicyInput) (*request.Request, *iam.GetPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetPolicyOutput) + return ret0, ret1 +} + +// GetPolicyRequest indicates an expected call of GetPolicyRequest. +func (mr *MockIAMAPIMockRecorder) GetPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetPolicyRequest), arg0) +} + +// GetPolicyVersion mocks base method. +func (m *MockIAMAPI) GetPolicyVersion(arg0 *iam.GetPolicyVersionInput) (*iam.GetPolicyVersionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPolicyVersion", arg0) + ret0, _ := ret[0].(*iam.GetPolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicyVersion indicates an expected call of GetPolicyVersion. +func (mr *MockIAMAPIMockRecorder) GetPolicyVersion(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicyVersion", reflect.TypeOf((*MockIAMAPI)(nil).GetPolicyVersion), arg0) +} + +// GetPolicyVersionRequest mocks base method. +func (m *MockIAMAPI) GetPolicyVersionRequest(arg0 *iam.GetPolicyVersionInput) (*request.Request, *iam.GetPolicyVersionOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPolicyVersionRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetPolicyVersionOutput) + return ret0, ret1 +} + +// GetPolicyVersionRequest indicates an expected call of GetPolicyVersionRequest. +func (mr *MockIAMAPIMockRecorder) GetPolicyVersionRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicyVersionRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetPolicyVersionRequest), arg0) +} + +// GetPolicyVersionWithContext mocks base method. +func (m *MockIAMAPI) GetPolicyVersionWithContext(arg0 aws.Context, arg1 *iam.GetPolicyVersionInput, arg2 ...request.Option) (*iam.GetPolicyVersionOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetPolicyVersionWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetPolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicyVersionWithContext indicates an expected call of GetPolicyVersionWithContext. +func (mr *MockIAMAPIMockRecorder) GetPolicyVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicyVersionWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetPolicyVersionWithContext), varargs...) +} + +// GetPolicyWithContext mocks base method. +func (m *MockIAMAPI) GetPolicyWithContext(arg0 aws.Context, arg1 *iam.GetPolicyInput, arg2 ...request.Option) (*iam.GetPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicyWithContext indicates an expected call of GetPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) GetPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetPolicyWithContext), varargs...) +} + +// GetRole mocks base method. +func (m *MockIAMAPI) GetRole(arg0 *iam.GetRoleInput) (*iam.GetRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRole", arg0) + ret0, _ := ret[0].(*iam.GetRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRole indicates an expected call of GetRole. +func (mr *MockIAMAPIMockRecorder) GetRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRole", reflect.TypeOf((*MockIAMAPI)(nil).GetRole), arg0) +} + +// GetRolePolicy mocks base method. +func (m *MockIAMAPI) GetRolePolicy(arg0 *iam.GetRolePolicyInput) (*iam.GetRolePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRolePolicy", arg0) + ret0, _ := ret[0].(*iam.GetRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRolePolicy indicates an expected call of GetRolePolicy. +func (mr *MockIAMAPIMockRecorder) GetRolePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRolePolicy", reflect.TypeOf((*MockIAMAPI)(nil).GetRolePolicy), arg0) +} + +// GetRolePolicyRequest mocks base method. +func (m *MockIAMAPI) GetRolePolicyRequest(arg0 *iam.GetRolePolicyInput) (*request.Request, *iam.GetRolePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRolePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetRolePolicyOutput) + return ret0, ret1 +} + +// GetRolePolicyRequest indicates an expected call of GetRolePolicyRequest. +func (mr *MockIAMAPIMockRecorder) GetRolePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRolePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetRolePolicyRequest), arg0) +} + +// GetRolePolicyWithContext mocks base method. +func (m *MockIAMAPI) GetRolePolicyWithContext(arg0 aws.Context, arg1 *iam.GetRolePolicyInput, arg2 ...request.Option) (*iam.GetRolePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetRolePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRolePolicyWithContext indicates an expected call of GetRolePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) GetRolePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRolePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetRolePolicyWithContext), varargs...) +} + +// GetRoleRequest mocks base method. +func (m *MockIAMAPI) GetRoleRequest(arg0 *iam.GetRoleInput) (*request.Request, *iam.GetRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetRoleOutput) + return ret0, ret1 +} + +// GetRoleRequest indicates an expected call of GetRoleRequest. +func (mr *MockIAMAPIMockRecorder) GetRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetRoleRequest), arg0) +} + +// GetRoleWithContext mocks base method. +func (m *MockIAMAPI) GetRoleWithContext(arg0 aws.Context, arg1 *iam.GetRoleInput, arg2 ...request.Option) (*iam.GetRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRoleWithContext indicates an expected call of GetRoleWithContext. +func (mr *MockIAMAPIMockRecorder) GetRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetRoleWithContext), varargs...) +} + +// GetSAMLProvider mocks base method. +func (m *MockIAMAPI) GetSAMLProvider(arg0 *iam.GetSAMLProviderInput) (*iam.GetSAMLProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSAMLProvider", arg0) + ret0, _ := ret[0].(*iam.GetSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSAMLProvider indicates an expected call of GetSAMLProvider. +func (mr *MockIAMAPIMockRecorder) GetSAMLProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSAMLProvider", reflect.TypeOf((*MockIAMAPI)(nil).GetSAMLProvider), arg0) +} + +// GetSAMLProviderRequest mocks base method. +func (m *MockIAMAPI) GetSAMLProviderRequest(arg0 *iam.GetSAMLProviderInput) (*request.Request, *iam.GetSAMLProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSAMLProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetSAMLProviderOutput) + return ret0, ret1 +} + +// GetSAMLProviderRequest indicates an expected call of GetSAMLProviderRequest. +func (mr *MockIAMAPIMockRecorder) GetSAMLProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSAMLProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetSAMLProviderRequest), arg0) +} + +// GetSAMLProviderWithContext mocks base method. +func (m *MockIAMAPI) GetSAMLProviderWithContext(arg0 aws.Context, arg1 *iam.GetSAMLProviderInput, arg2 ...request.Option) (*iam.GetSAMLProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetSAMLProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSAMLProviderWithContext indicates an expected call of GetSAMLProviderWithContext. +func (mr *MockIAMAPIMockRecorder) GetSAMLProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSAMLProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetSAMLProviderWithContext), varargs...) +} + +// GetSSHPublicKey mocks base method. +func (m *MockIAMAPI) GetSSHPublicKey(arg0 *iam.GetSSHPublicKeyInput) (*iam.GetSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSSHPublicKey", arg0) + ret0, _ := ret[0].(*iam.GetSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSSHPublicKey indicates an expected call of GetSSHPublicKey. +func (mr *MockIAMAPIMockRecorder) GetSSHPublicKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSSHPublicKey", reflect.TypeOf((*MockIAMAPI)(nil).GetSSHPublicKey), arg0) +} + +// GetSSHPublicKeyRequest mocks base method. +func (m *MockIAMAPI) GetSSHPublicKeyRequest(arg0 *iam.GetSSHPublicKeyInput) (*request.Request, *iam.GetSSHPublicKeyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSSHPublicKeyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetSSHPublicKeyOutput) + return ret0, ret1 +} + +// GetSSHPublicKeyRequest indicates an expected call of GetSSHPublicKeyRequest. +func (mr *MockIAMAPIMockRecorder) GetSSHPublicKeyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSSHPublicKeyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetSSHPublicKeyRequest), arg0) +} + +// GetSSHPublicKeyWithContext mocks base method. +func (m *MockIAMAPI) GetSSHPublicKeyWithContext(arg0 aws.Context, arg1 *iam.GetSSHPublicKeyInput, arg2 ...request.Option) (*iam.GetSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetSSHPublicKeyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSSHPublicKeyWithContext indicates an expected call of GetSSHPublicKeyWithContext. +func (mr *MockIAMAPIMockRecorder) GetSSHPublicKeyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSSHPublicKeyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetSSHPublicKeyWithContext), varargs...) +} + +// GetServerCertificate mocks base method. +func (m *MockIAMAPI) GetServerCertificate(arg0 *iam.GetServerCertificateInput) (*iam.GetServerCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServerCertificate", arg0) + ret0, _ := ret[0].(*iam.GetServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServerCertificate indicates an expected call of GetServerCertificate. +func (mr *MockIAMAPIMockRecorder) GetServerCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServerCertificate", reflect.TypeOf((*MockIAMAPI)(nil).GetServerCertificate), arg0) +} + +// GetServerCertificateRequest mocks base method. +func (m *MockIAMAPI) GetServerCertificateRequest(arg0 *iam.GetServerCertificateInput) (*request.Request, *iam.GetServerCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServerCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetServerCertificateOutput) + return ret0, ret1 +} + +// GetServerCertificateRequest indicates an expected call of GetServerCertificateRequest. +func (mr *MockIAMAPIMockRecorder) GetServerCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServerCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetServerCertificateRequest), arg0) +} + +// GetServerCertificateWithContext mocks base method. +func (m *MockIAMAPI) GetServerCertificateWithContext(arg0 aws.Context, arg1 *iam.GetServerCertificateInput, arg2 ...request.Option) (*iam.GetServerCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetServerCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServerCertificateWithContext indicates an expected call of GetServerCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) GetServerCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServerCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetServerCertificateWithContext), varargs...) +} + +// GetServiceLastAccessedDetails mocks base method. +func (m *MockIAMAPI) GetServiceLastAccessedDetails(arg0 *iam.GetServiceLastAccessedDetailsInput) (*iam.GetServiceLastAccessedDetailsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceLastAccessedDetails", arg0) + ret0, _ := ret[0].(*iam.GetServiceLastAccessedDetailsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceLastAccessedDetails indicates an expected call of GetServiceLastAccessedDetails. +func (mr *MockIAMAPIMockRecorder) GetServiceLastAccessedDetails(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLastAccessedDetails", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLastAccessedDetails), arg0) +} + +// GetServiceLastAccessedDetailsRequest mocks base method. +func (m *MockIAMAPI) GetServiceLastAccessedDetailsRequest(arg0 *iam.GetServiceLastAccessedDetailsInput) (*request.Request, *iam.GetServiceLastAccessedDetailsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceLastAccessedDetailsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetServiceLastAccessedDetailsOutput) + return ret0, ret1 +} + +// GetServiceLastAccessedDetailsRequest indicates an expected call of GetServiceLastAccessedDetailsRequest. +func (mr *MockIAMAPIMockRecorder) GetServiceLastAccessedDetailsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLastAccessedDetailsRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLastAccessedDetailsRequest), arg0) +} + +// GetServiceLastAccessedDetailsWithContext mocks base method. +func (m *MockIAMAPI) GetServiceLastAccessedDetailsWithContext(arg0 aws.Context, arg1 *iam.GetServiceLastAccessedDetailsInput, arg2 ...request.Option) (*iam.GetServiceLastAccessedDetailsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetServiceLastAccessedDetailsWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetServiceLastAccessedDetailsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceLastAccessedDetailsWithContext indicates an expected call of GetServiceLastAccessedDetailsWithContext. +func (mr *MockIAMAPIMockRecorder) GetServiceLastAccessedDetailsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLastAccessedDetailsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLastAccessedDetailsWithContext), varargs...) +} + +// GetServiceLastAccessedDetailsWithEntities mocks base method. +func (m *MockIAMAPI) GetServiceLastAccessedDetailsWithEntities(arg0 *iam.GetServiceLastAccessedDetailsWithEntitiesInput) (*iam.GetServiceLastAccessedDetailsWithEntitiesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceLastAccessedDetailsWithEntities", arg0) + ret0, _ := ret[0].(*iam.GetServiceLastAccessedDetailsWithEntitiesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceLastAccessedDetailsWithEntities indicates an expected call of GetServiceLastAccessedDetailsWithEntities. +func (mr *MockIAMAPIMockRecorder) GetServiceLastAccessedDetailsWithEntities(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLastAccessedDetailsWithEntities", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLastAccessedDetailsWithEntities), arg0) +} + +// GetServiceLastAccessedDetailsWithEntitiesRequest mocks base method. +func (m *MockIAMAPI) GetServiceLastAccessedDetailsWithEntitiesRequest(arg0 *iam.GetServiceLastAccessedDetailsWithEntitiesInput) (*request.Request, *iam.GetServiceLastAccessedDetailsWithEntitiesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceLastAccessedDetailsWithEntitiesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetServiceLastAccessedDetailsWithEntitiesOutput) + return ret0, ret1 +} + +// GetServiceLastAccessedDetailsWithEntitiesRequest indicates an expected call of GetServiceLastAccessedDetailsWithEntitiesRequest. +func (mr *MockIAMAPIMockRecorder) GetServiceLastAccessedDetailsWithEntitiesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLastAccessedDetailsWithEntitiesRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLastAccessedDetailsWithEntitiesRequest), arg0) +} + +// GetServiceLastAccessedDetailsWithEntitiesWithContext mocks base method. +func (m *MockIAMAPI) GetServiceLastAccessedDetailsWithEntitiesWithContext(arg0 aws.Context, arg1 *iam.GetServiceLastAccessedDetailsWithEntitiesInput, arg2 ...request.Option) (*iam.GetServiceLastAccessedDetailsWithEntitiesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetServiceLastAccessedDetailsWithEntitiesWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetServiceLastAccessedDetailsWithEntitiesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceLastAccessedDetailsWithEntitiesWithContext indicates an expected call of GetServiceLastAccessedDetailsWithEntitiesWithContext. +func (mr *MockIAMAPIMockRecorder) GetServiceLastAccessedDetailsWithEntitiesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLastAccessedDetailsWithEntitiesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLastAccessedDetailsWithEntitiesWithContext), varargs...) +} + +// GetServiceLinkedRoleDeletionStatus mocks base method. +func (m *MockIAMAPI) GetServiceLinkedRoleDeletionStatus(arg0 *iam.GetServiceLinkedRoleDeletionStatusInput) (*iam.GetServiceLinkedRoleDeletionStatusOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceLinkedRoleDeletionStatus", arg0) + ret0, _ := ret[0].(*iam.GetServiceLinkedRoleDeletionStatusOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceLinkedRoleDeletionStatus indicates an expected call of GetServiceLinkedRoleDeletionStatus. +func (mr *MockIAMAPIMockRecorder) GetServiceLinkedRoleDeletionStatus(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLinkedRoleDeletionStatus", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLinkedRoleDeletionStatus), arg0) +} + +// GetServiceLinkedRoleDeletionStatusRequest mocks base method. +func (m *MockIAMAPI) GetServiceLinkedRoleDeletionStatusRequest(arg0 *iam.GetServiceLinkedRoleDeletionStatusInput) (*request.Request, *iam.GetServiceLinkedRoleDeletionStatusOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceLinkedRoleDeletionStatusRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetServiceLinkedRoleDeletionStatusOutput) + return ret0, ret1 +} + +// GetServiceLinkedRoleDeletionStatusRequest indicates an expected call of GetServiceLinkedRoleDeletionStatusRequest. +func (mr *MockIAMAPIMockRecorder) GetServiceLinkedRoleDeletionStatusRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLinkedRoleDeletionStatusRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLinkedRoleDeletionStatusRequest), arg0) +} + +// GetServiceLinkedRoleDeletionStatusWithContext mocks base method. +func (m *MockIAMAPI) GetServiceLinkedRoleDeletionStatusWithContext(arg0 aws.Context, arg1 *iam.GetServiceLinkedRoleDeletionStatusInput, arg2 ...request.Option) (*iam.GetServiceLinkedRoleDeletionStatusOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetServiceLinkedRoleDeletionStatusWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetServiceLinkedRoleDeletionStatusOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetServiceLinkedRoleDeletionStatusWithContext indicates an expected call of GetServiceLinkedRoleDeletionStatusWithContext. +func (mr *MockIAMAPIMockRecorder) GetServiceLinkedRoleDeletionStatusWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceLinkedRoleDeletionStatusWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetServiceLinkedRoleDeletionStatusWithContext), varargs...) +} + +// GetUser mocks base method. +func (m *MockIAMAPI) GetUser(arg0 *iam.GetUserInput) (*iam.GetUserOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUser", arg0) + ret0, _ := ret[0].(*iam.GetUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUser indicates an expected call of GetUser. +func (mr *MockIAMAPIMockRecorder) GetUser(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUser", reflect.TypeOf((*MockIAMAPI)(nil).GetUser), arg0) +} + +// GetUserPolicy mocks base method. +func (m *MockIAMAPI) GetUserPolicy(arg0 *iam.GetUserPolicyInput) (*iam.GetUserPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUserPolicy", arg0) + ret0, _ := ret[0].(*iam.GetUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUserPolicy indicates an expected call of GetUserPolicy. +func (mr *MockIAMAPIMockRecorder) GetUserPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserPolicy", reflect.TypeOf((*MockIAMAPI)(nil).GetUserPolicy), arg0) +} + +// GetUserPolicyRequest mocks base method. +func (m *MockIAMAPI) GetUserPolicyRequest(arg0 *iam.GetUserPolicyInput) (*request.Request, *iam.GetUserPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUserPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetUserPolicyOutput) + return ret0, ret1 +} + +// GetUserPolicyRequest indicates an expected call of GetUserPolicyRequest. +func (mr *MockIAMAPIMockRecorder) GetUserPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetUserPolicyRequest), arg0) +} + +// GetUserPolicyWithContext mocks base method. +func (m *MockIAMAPI) GetUserPolicyWithContext(arg0 aws.Context, arg1 *iam.GetUserPolicyInput, arg2 ...request.Option) (*iam.GetUserPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetUserPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUserPolicyWithContext indicates an expected call of GetUserPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) GetUserPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetUserPolicyWithContext), varargs...) +} + +// GetUserRequest mocks base method. +func (m *MockIAMAPI) GetUserRequest(arg0 *iam.GetUserInput) (*request.Request, *iam.GetUserOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUserRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.GetUserOutput) + return ret0, ret1 +} + +// GetUserRequest indicates an expected call of GetUserRequest. +func (mr *MockIAMAPIMockRecorder) GetUserRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserRequest", reflect.TypeOf((*MockIAMAPI)(nil).GetUserRequest), arg0) +} + +// GetUserWithContext mocks base method. +func (m *MockIAMAPI) GetUserWithContext(arg0 aws.Context, arg1 *iam.GetUserInput, arg2 ...request.Option) (*iam.GetUserOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetUserWithContext", varargs...) + ret0, _ := ret[0].(*iam.GetUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUserWithContext indicates an expected call of GetUserWithContext. +func (mr *MockIAMAPIMockRecorder) GetUserWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserWithContext", reflect.TypeOf((*MockIAMAPI)(nil).GetUserWithContext), varargs...) +} + +// ListAccessKeys mocks base method. +func (m *MockIAMAPI) ListAccessKeys(arg0 *iam.ListAccessKeysInput) (*iam.ListAccessKeysOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAccessKeys", arg0) + ret0, _ := ret[0].(*iam.ListAccessKeysOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAccessKeys indicates an expected call of ListAccessKeys. +func (mr *MockIAMAPIMockRecorder) ListAccessKeys(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccessKeys", reflect.TypeOf((*MockIAMAPI)(nil).ListAccessKeys), arg0) +} + +// ListAccessKeysPages mocks base method. +func (m *MockIAMAPI) ListAccessKeysPages(arg0 *iam.ListAccessKeysInput, arg1 func(*iam.ListAccessKeysOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAccessKeysPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAccessKeysPages indicates an expected call of ListAccessKeysPages. +func (mr *MockIAMAPIMockRecorder) ListAccessKeysPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccessKeysPages", reflect.TypeOf((*MockIAMAPI)(nil).ListAccessKeysPages), arg0, arg1) +} + +// ListAccessKeysPagesWithContext mocks base method. +func (m *MockIAMAPI) ListAccessKeysPagesWithContext(arg0 aws.Context, arg1 *iam.ListAccessKeysInput, arg2 func(*iam.ListAccessKeysOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAccessKeysPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAccessKeysPagesWithContext indicates an expected call of ListAccessKeysPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAccessKeysPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccessKeysPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAccessKeysPagesWithContext), varargs...) +} + +// ListAccessKeysRequest mocks base method. +func (m *MockIAMAPI) ListAccessKeysRequest(arg0 *iam.ListAccessKeysInput) (*request.Request, *iam.ListAccessKeysOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAccessKeysRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListAccessKeysOutput) + return ret0, ret1 +} + +// ListAccessKeysRequest indicates an expected call of ListAccessKeysRequest. +func (mr *MockIAMAPIMockRecorder) ListAccessKeysRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccessKeysRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListAccessKeysRequest), arg0) +} + +// ListAccessKeysWithContext mocks base method. +func (m *MockIAMAPI) ListAccessKeysWithContext(arg0 aws.Context, arg1 *iam.ListAccessKeysInput, arg2 ...request.Option) (*iam.ListAccessKeysOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAccessKeysWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListAccessKeysOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAccessKeysWithContext indicates an expected call of ListAccessKeysWithContext. +func (mr *MockIAMAPIMockRecorder) ListAccessKeysWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccessKeysWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAccessKeysWithContext), varargs...) +} + +// ListAccountAliases mocks base method. +func (m *MockIAMAPI) ListAccountAliases(arg0 *iam.ListAccountAliasesInput) (*iam.ListAccountAliasesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAccountAliases", arg0) + ret0, _ := ret[0].(*iam.ListAccountAliasesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAccountAliases indicates an expected call of ListAccountAliases. +func (mr *MockIAMAPIMockRecorder) ListAccountAliases(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccountAliases", reflect.TypeOf((*MockIAMAPI)(nil).ListAccountAliases), arg0) +} + +// ListAccountAliasesPages mocks base method. +func (m *MockIAMAPI) ListAccountAliasesPages(arg0 *iam.ListAccountAliasesInput, arg1 func(*iam.ListAccountAliasesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAccountAliasesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAccountAliasesPages indicates an expected call of ListAccountAliasesPages. +func (mr *MockIAMAPIMockRecorder) ListAccountAliasesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccountAliasesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListAccountAliasesPages), arg0, arg1) +} + +// ListAccountAliasesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListAccountAliasesPagesWithContext(arg0 aws.Context, arg1 *iam.ListAccountAliasesInput, arg2 func(*iam.ListAccountAliasesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAccountAliasesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAccountAliasesPagesWithContext indicates an expected call of ListAccountAliasesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAccountAliasesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccountAliasesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAccountAliasesPagesWithContext), varargs...) +} + +// ListAccountAliasesRequest mocks base method. +func (m *MockIAMAPI) ListAccountAliasesRequest(arg0 *iam.ListAccountAliasesInput) (*request.Request, *iam.ListAccountAliasesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAccountAliasesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListAccountAliasesOutput) + return ret0, ret1 +} + +// ListAccountAliasesRequest indicates an expected call of ListAccountAliasesRequest. +func (mr *MockIAMAPIMockRecorder) ListAccountAliasesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccountAliasesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListAccountAliasesRequest), arg0) +} + +// ListAccountAliasesWithContext mocks base method. +func (m *MockIAMAPI) ListAccountAliasesWithContext(arg0 aws.Context, arg1 *iam.ListAccountAliasesInput, arg2 ...request.Option) (*iam.ListAccountAliasesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAccountAliasesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListAccountAliasesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAccountAliasesWithContext indicates an expected call of ListAccountAliasesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAccountAliasesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAccountAliasesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAccountAliasesWithContext), varargs...) +} + +// ListAttachedGroupPolicies mocks base method. +func (m *MockIAMAPI) ListAttachedGroupPolicies(arg0 *iam.ListAttachedGroupPoliciesInput) (*iam.ListAttachedGroupPoliciesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedGroupPolicies", arg0) + ret0, _ := ret[0].(*iam.ListAttachedGroupPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAttachedGroupPolicies indicates an expected call of ListAttachedGroupPolicies. +func (mr *MockIAMAPIMockRecorder) ListAttachedGroupPolicies(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedGroupPolicies", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedGroupPolicies), arg0) +} + +// ListAttachedGroupPoliciesPages mocks base method. +func (m *MockIAMAPI) ListAttachedGroupPoliciesPages(arg0 *iam.ListAttachedGroupPoliciesInput, arg1 func(*iam.ListAttachedGroupPoliciesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedGroupPoliciesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAttachedGroupPoliciesPages indicates an expected call of ListAttachedGroupPoliciesPages. +func (mr *MockIAMAPIMockRecorder) ListAttachedGroupPoliciesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedGroupPoliciesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedGroupPoliciesPages), arg0, arg1) +} + +// ListAttachedGroupPoliciesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListAttachedGroupPoliciesPagesWithContext(arg0 aws.Context, arg1 *iam.ListAttachedGroupPoliciesInput, arg2 func(*iam.ListAttachedGroupPoliciesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAttachedGroupPoliciesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAttachedGroupPoliciesPagesWithContext indicates an expected call of ListAttachedGroupPoliciesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAttachedGroupPoliciesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedGroupPoliciesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedGroupPoliciesPagesWithContext), varargs...) +} + +// ListAttachedGroupPoliciesRequest mocks base method. +func (m *MockIAMAPI) ListAttachedGroupPoliciesRequest(arg0 *iam.ListAttachedGroupPoliciesInput) (*request.Request, *iam.ListAttachedGroupPoliciesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedGroupPoliciesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListAttachedGroupPoliciesOutput) + return ret0, ret1 +} + +// ListAttachedGroupPoliciesRequest indicates an expected call of ListAttachedGroupPoliciesRequest. +func (mr *MockIAMAPIMockRecorder) ListAttachedGroupPoliciesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedGroupPoliciesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedGroupPoliciesRequest), arg0) +} + +// ListAttachedGroupPoliciesWithContext mocks base method. +func (m *MockIAMAPI) ListAttachedGroupPoliciesWithContext(arg0 aws.Context, arg1 *iam.ListAttachedGroupPoliciesInput, arg2 ...request.Option) (*iam.ListAttachedGroupPoliciesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAttachedGroupPoliciesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListAttachedGroupPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAttachedGroupPoliciesWithContext indicates an expected call of ListAttachedGroupPoliciesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAttachedGroupPoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedGroupPoliciesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedGroupPoliciesWithContext), varargs...) +} + +// ListAttachedRolePolicies mocks base method. +func (m *MockIAMAPI) ListAttachedRolePolicies(arg0 *iam.ListAttachedRolePoliciesInput) (*iam.ListAttachedRolePoliciesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedRolePolicies", arg0) + ret0, _ := ret[0].(*iam.ListAttachedRolePoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAttachedRolePolicies indicates an expected call of ListAttachedRolePolicies. +func (mr *MockIAMAPIMockRecorder) ListAttachedRolePolicies(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedRolePolicies", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedRolePolicies), arg0) +} + +// ListAttachedRolePoliciesPages mocks base method. +func (m *MockIAMAPI) ListAttachedRolePoliciesPages(arg0 *iam.ListAttachedRolePoliciesInput, arg1 func(*iam.ListAttachedRolePoliciesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedRolePoliciesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAttachedRolePoliciesPages indicates an expected call of ListAttachedRolePoliciesPages. +func (mr *MockIAMAPIMockRecorder) ListAttachedRolePoliciesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedRolePoliciesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedRolePoliciesPages), arg0, arg1) +} + +// ListAttachedRolePoliciesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListAttachedRolePoliciesPagesWithContext(arg0 aws.Context, arg1 *iam.ListAttachedRolePoliciesInput, arg2 func(*iam.ListAttachedRolePoliciesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAttachedRolePoliciesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAttachedRolePoliciesPagesWithContext indicates an expected call of ListAttachedRolePoliciesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAttachedRolePoliciesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedRolePoliciesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedRolePoliciesPagesWithContext), varargs...) +} + +// ListAttachedRolePoliciesRequest mocks base method. +func (m *MockIAMAPI) ListAttachedRolePoliciesRequest(arg0 *iam.ListAttachedRolePoliciesInput) (*request.Request, *iam.ListAttachedRolePoliciesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedRolePoliciesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListAttachedRolePoliciesOutput) + return ret0, ret1 +} + +// ListAttachedRolePoliciesRequest indicates an expected call of ListAttachedRolePoliciesRequest. +func (mr *MockIAMAPIMockRecorder) ListAttachedRolePoliciesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedRolePoliciesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedRolePoliciesRequest), arg0) +} + +// ListAttachedRolePoliciesWithContext mocks base method. +func (m *MockIAMAPI) ListAttachedRolePoliciesWithContext(arg0 aws.Context, arg1 *iam.ListAttachedRolePoliciesInput, arg2 ...request.Option) (*iam.ListAttachedRolePoliciesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAttachedRolePoliciesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListAttachedRolePoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAttachedRolePoliciesWithContext indicates an expected call of ListAttachedRolePoliciesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAttachedRolePoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedRolePoliciesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedRolePoliciesWithContext), varargs...) +} + +// ListAttachedUserPolicies mocks base method. +func (m *MockIAMAPI) ListAttachedUserPolicies(arg0 *iam.ListAttachedUserPoliciesInput) (*iam.ListAttachedUserPoliciesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedUserPolicies", arg0) + ret0, _ := ret[0].(*iam.ListAttachedUserPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAttachedUserPolicies indicates an expected call of ListAttachedUserPolicies. +func (mr *MockIAMAPIMockRecorder) ListAttachedUserPolicies(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedUserPolicies", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedUserPolicies), arg0) +} + +// ListAttachedUserPoliciesPages mocks base method. +func (m *MockIAMAPI) ListAttachedUserPoliciesPages(arg0 *iam.ListAttachedUserPoliciesInput, arg1 func(*iam.ListAttachedUserPoliciesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedUserPoliciesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAttachedUserPoliciesPages indicates an expected call of ListAttachedUserPoliciesPages. +func (mr *MockIAMAPIMockRecorder) ListAttachedUserPoliciesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedUserPoliciesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedUserPoliciesPages), arg0, arg1) +} + +// ListAttachedUserPoliciesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListAttachedUserPoliciesPagesWithContext(arg0 aws.Context, arg1 *iam.ListAttachedUserPoliciesInput, arg2 func(*iam.ListAttachedUserPoliciesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAttachedUserPoliciesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListAttachedUserPoliciesPagesWithContext indicates an expected call of ListAttachedUserPoliciesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAttachedUserPoliciesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedUserPoliciesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedUserPoliciesPagesWithContext), varargs...) +} + +// ListAttachedUserPoliciesRequest mocks base method. +func (m *MockIAMAPI) ListAttachedUserPoliciesRequest(arg0 *iam.ListAttachedUserPoliciesInput) (*request.Request, *iam.ListAttachedUserPoliciesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListAttachedUserPoliciesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListAttachedUserPoliciesOutput) + return ret0, ret1 +} + +// ListAttachedUserPoliciesRequest indicates an expected call of ListAttachedUserPoliciesRequest. +func (mr *MockIAMAPIMockRecorder) ListAttachedUserPoliciesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedUserPoliciesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedUserPoliciesRequest), arg0) +} + +// ListAttachedUserPoliciesWithContext mocks base method. +func (m *MockIAMAPI) ListAttachedUserPoliciesWithContext(arg0 aws.Context, arg1 *iam.ListAttachedUserPoliciesInput, arg2 ...request.Option) (*iam.ListAttachedUserPoliciesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListAttachedUserPoliciesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListAttachedUserPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListAttachedUserPoliciesWithContext indicates an expected call of ListAttachedUserPoliciesWithContext. +func (mr *MockIAMAPIMockRecorder) ListAttachedUserPoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAttachedUserPoliciesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListAttachedUserPoliciesWithContext), varargs...) +} + +// ListEntitiesForPolicy mocks base method. +func (m *MockIAMAPI) ListEntitiesForPolicy(arg0 *iam.ListEntitiesForPolicyInput) (*iam.ListEntitiesForPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListEntitiesForPolicy", arg0) + ret0, _ := ret[0].(*iam.ListEntitiesForPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListEntitiesForPolicy indicates an expected call of ListEntitiesForPolicy. +func (mr *MockIAMAPIMockRecorder) ListEntitiesForPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEntitiesForPolicy", reflect.TypeOf((*MockIAMAPI)(nil).ListEntitiesForPolicy), arg0) +} + +// ListEntitiesForPolicyPages mocks base method. +func (m *MockIAMAPI) ListEntitiesForPolicyPages(arg0 *iam.ListEntitiesForPolicyInput, arg1 func(*iam.ListEntitiesForPolicyOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListEntitiesForPolicyPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListEntitiesForPolicyPages indicates an expected call of ListEntitiesForPolicyPages. +func (mr *MockIAMAPIMockRecorder) ListEntitiesForPolicyPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEntitiesForPolicyPages", reflect.TypeOf((*MockIAMAPI)(nil).ListEntitiesForPolicyPages), arg0, arg1) +} + +// ListEntitiesForPolicyPagesWithContext mocks base method. +func (m *MockIAMAPI) ListEntitiesForPolicyPagesWithContext(arg0 aws.Context, arg1 *iam.ListEntitiesForPolicyInput, arg2 func(*iam.ListEntitiesForPolicyOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListEntitiesForPolicyPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListEntitiesForPolicyPagesWithContext indicates an expected call of ListEntitiesForPolicyPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListEntitiesForPolicyPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEntitiesForPolicyPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListEntitiesForPolicyPagesWithContext), varargs...) +} + +// ListEntitiesForPolicyRequest mocks base method. +func (m *MockIAMAPI) ListEntitiesForPolicyRequest(arg0 *iam.ListEntitiesForPolicyInput) (*request.Request, *iam.ListEntitiesForPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListEntitiesForPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListEntitiesForPolicyOutput) + return ret0, ret1 +} + +// ListEntitiesForPolicyRequest indicates an expected call of ListEntitiesForPolicyRequest. +func (mr *MockIAMAPIMockRecorder) ListEntitiesForPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEntitiesForPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListEntitiesForPolicyRequest), arg0) +} + +// ListEntitiesForPolicyWithContext mocks base method. +func (m *MockIAMAPI) ListEntitiesForPolicyWithContext(arg0 aws.Context, arg1 *iam.ListEntitiesForPolicyInput, arg2 ...request.Option) (*iam.ListEntitiesForPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListEntitiesForPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListEntitiesForPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListEntitiesForPolicyWithContext indicates an expected call of ListEntitiesForPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) ListEntitiesForPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEntitiesForPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListEntitiesForPolicyWithContext), varargs...) +} + +// ListGroupPolicies mocks base method. +func (m *MockIAMAPI) ListGroupPolicies(arg0 *iam.ListGroupPoliciesInput) (*iam.ListGroupPoliciesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupPolicies", arg0) + ret0, _ := ret[0].(*iam.ListGroupPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGroupPolicies indicates an expected call of ListGroupPolicies. +func (mr *MockIAMAPIMockRecorder) ListGroupPolicies(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupPolicies", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupPolicies), arg0) +} + +// ListGroupPoliciesPages mocks base method. +func (m *MockIAMAPI) ListGroupPoliciesPages(arg0 *iam.ListGroupPoliciesInput, arg1 func(*iam.ListGroupPoliciesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupPoliciesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListGroupPoliciesPages indicates an expected call of ListGroupPoliciesPages. +func (mr *MockIAMAPIMockRecorder) ListGroupPoliciesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupPoliciesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupPoliciesPages), arg0, arg1) +} + +// ListGroupPoliciesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListGroupPoliciesPagesWithContext(arg0 aws.Context, arg1 *iam.ListGroupPoliciesInput, arg2 func(*iam.ListGroupPoliciesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGroupPoliciesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListGroupPoliciesPagesWithContext indicates an expected call of ListGroupPoliciesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListGroupPoliciesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupPoliciesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupPoliciesPagesWithContext), varargs...) +} + +// ListGroupPoliciesRequest mocks base method. +func (m *MockIAMAPI) ListGroupPoliciesRequest(arg0 *iam.ListGroupPoliciesInput) (*request.Request, *iam.ListGroupPoliciesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupPoliciesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListGroupPoliciesOutput) + return ret0, ret1 +} + +// ListGroupPoliciesRequest indicates an expected call of ListGroupPoliciesRequest. +func (mr *MockIAMAPIMockRecorder) ListGroupPoliciesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupPoliciesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupPoliciesRequest), arg0) +} + +// ListGroupPoliciesWithContext mocks base method. +func (m *MockIAMAPI) ListGroupPoliciesWithContext(arg0 aws.Context, arg1 *iam.ListGroupPoliciesInput, arg2 ...request.Option) (*iam.ListGroupPoliciesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGroupPoliciesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListGroupPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGroupPoliciesWithContext indicates an expected call of ListGroupPoliciesWithContext. +func (mr *MockIAMAPIMockRecorder) ListGroupPoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupPoliciesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupPoliciesWithContext), varargs...) +} + +// ListGroups mocks base method. +func (m *MockIAMAPI) ListGroups(arg0 *iam.ListGroupsInput) (*iam.ListGroupsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroups", arg0) + ret0, _ := ret[0].(*iam.ListGroupsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGroups indicates an expected call of ListGroups. +func (mr *MockIAMAPIMockRecorder) ListGroups(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroups", reflect.TypeOf((*MockIAMAPI)(nil).ListGroups), arg0) +} + +// ListGroupsForUser mocks base method. +func (m *MockIAMAPI) ListGroupsForUser(arg0 *iam.ListGroupsForUserInput) (*iam.ListGroupsForUserOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupsForUser", arg0) + ret0, _ := ret[0].(*iam.ListGroupsForUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGroupsForUser indicates an expected call of ListGroupsForUser. +func (mr *MockIAMAPIMockRecorder) ListGroupsForUser(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsForUser", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsForUser), arg0) +} + +// ListGroupsForUserPages mocks base method. +func (m *MockIAMAPI) ListGroupsForUserPages(arg0 *iam.ListGroupsForUserInput, arg1 func(*iam.ListGroupsForUserOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupsForUserPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListGroupsForUserPages indicates an expected call of ListGroupsForUserPages. +func (mr *MockIAMAPIMockRecorder) ListGroupsForUserPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsForUserPages", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsForUserPages), arg0, arg1) +} + +// ListGroupsForUserPagesWithContext mocks base method. +func (m *MockIAMAPI) ListGroupsForUserPagesWithContext(arg0 aws.Context, arg1 *iam.ListGroupsForUserInput, arg2 func(*iam.ListGroupsForUserOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGroupsForUserPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListGroupsForUserPagesWithContext indicates an expected call of ListGroupsForUserPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListGroupsForUserPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsForUserPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsForUserPagesWithContext), varargs...) +} + +// ListGroupsForUserRequest mocks base method. +func (m *MockIAMAPI) ListGroupsForUserRequest(arg0 *iam.ListGroupsForUserInput) (*request.Request, *iam.ListGroupsForUserOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupsForUserRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListGroupsForUserOutput) + return ret0, ret1 +} + +// ListGroupsForUserRequest indicates an expected call of ListGroupsForUserRequest. +func (mr *MockIAMAPIMockRecorder) ListGroupsForUserRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsForUserRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsForUserRequest), arg0) +} + +// ListGroupsForUserWithContext mocks base method. +func (m *MockIAMAPI) ListGroupsForUserWithContext(arg0 aws.Context, arg1 *iam.ListGroupsForUserInput, arg2 ...request.Option) (*iam.ListGroupsForUserOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGroupsForUserWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListGroupsForUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGroupsForUserWithContext indicates an expected call of ListGroupsForUserWithContext. +func (mr *MockIAMAPIMockRecorder) ListGroupsForUserWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsForUserWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsForUserWithContext), varargs...) +} + +// ListGroupsPages mocks base method. +func (m *MockIAMAPI) ListGroupsPages(arg0 *iam.ListGroupsInput, arg1 func(*iam.ListGroupsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListGroupsPages indicates an expected call of ListGroupsPages. +func (mr *MockIAMAPIMockRecorder) ListGroupsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsPages", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsPages), arg0, arg1) +} + +// ListGroupsPagesWithContext mocks base method. +func (m *MockIAMAPI) ListGroupsPagesWithContext(arg0 aws.Context, arg1 *iam.ListGroupsInput, arg2 func(*iam.ListGroupsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGroupsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListGroupsPagesWithContext indicates an expected call of ListGroupsPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListGroupsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsPagesWithContext), varargs...) +} + +// ListGroupsRequest mocks base method. +func (m *MockIAMAPI) ListGroupsRequest(arg0 *iam.ListGroupsInput) (*request.Request, *iam.ListGroupsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListGroupsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListGroupsOutput) + return ret0, ret1 +} + +// ListGroupsRequest indicates an expected call of ListGroupsRequest. +func (mr *MockIAMAPIMockRecorder) ListGroupsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsRequest), arg0) +} + +// ListGroupsWithContext mocks base method. +func (m *MockIAMAPI) ListGroupsWithContext(arg0 aws.Context, arg1 *iam.ListGroupsInput, arg2 ...request.Option) (*iam.ListGroupsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListGroupsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListGroupsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListGroupsWithContext indicates an expected call of ListGroupsWithContext. +func (mr *MockIAMAPIMockRecorder) ListGroupsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListGroupsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListGroupsWithContext), varargs...) +} + +// ListInstanceProfileTags mocks base method. +func (m *MockIAMAPI) ListInstanceProfileTags(arg0 *iam.ListInstanceProfileTagsInput) (*iam.ListInstanceProfileTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfileTags", arg0) + ret0, _ := ret[0].(*iam.ListInstanceProfileTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListInstanceProfileTags indicates an expected call of ListInstanceProfileTags. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfileTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfileTags", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfileTags), arg0) +} + +// ListInstanceProfileTagsRequest mocks base method. +func (m *MockIAMAPI) ListInstanceProfileTagsRequest(arg0 *iam.ListInstanceProfileTagsInput) (*request.Request, *iam.ListInstanceProfileTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfileTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListInstanceProfileTagsOutput) + return ret0, ret1 +} + +// ListInstanceProfileTagsRequest indicates an expected call of ListInstanceProfileTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfileTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfileTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfileTagsRequest), arg0) +} + +// ListInstanceProfileTagsWithContext mocks base method. +func (m *MockIAMAPI) ListInstanceProfileTagsWithContext(arg0 aws.Context, arg1 *iam.ListInstanceProfileTagsInput, arg2 ...request.Option) (*iam.ListInstanceProfileTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListInstanceProfileTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListInstanceProfileTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListInstanceProfileTagsWithContext indicates an expected call of ListInstanceProfileTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfileTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfileTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfileTagsWithContext), varargs...) +} + +// ListInstanceProfiles mocks base method. +func (m *MockIAMAPI) ListInstanceProfiles(arg0 *iam.ListInstanceProfilesInput) (*iam.ListInstanceProfilesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfiles", arg0) + ret0, _ := ret[0].(*iam.ListInstanceProfilesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListInstanceProfiles indicates an expected call of ListInstanceProfiles. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfiles(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfiles", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfiles), arg0) +} + +// ListInstanceProfilesForRole mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesForRole(arg0 *iam.ListInstanceProfilesForRoleInput) (*iam.ListInstanceProfilesForRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfilesForRole", arg0) + ret0, _ := ret[0].(*iam.ListInstanceProfilesForRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListInstanceProfilesForRole indicates an expected call of ListInstanceProfilesForRole. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesForRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesForRole", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesForRole), arg0) +} + +// ListInstanceProfilesForRolePages mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesForRolePages(arg0 *iam.ListInstanceProfilesForRoleInput, arg1 func(*iam.ListInstanceProfilesForRoleOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfilesForRolePages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListInstanceProfilesForRolePages indicates an expected call of ListInstanceProfilesForRolePages. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesForRolePages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesForRolePages", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesForRolePages), arg0, arg1) +} + +// ListInstanceProfilesForRolePagesWithContext mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesForRolePagesWithContext(arg0 aws.Context, arg1 *iam.ListInstanceProfilesForRoleInput, arg2 func(*iam.ListInstanceProfilesForRoleOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListInstanceProfilesForRolePagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListInstanceProfilesForRolePagesWithContext indicates an expected call of ListInstanceProfilesForRolePagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesForRolePagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesForRolePagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesForRolePagesWithContext), varargs...) +} + +// ListInstanceProfilesForRoleRequest mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesForRoleRequest(arg0 *iam.ListInstanceProfilesForRoleInput) (*request.Request, *iam.ListInstanceProfilesForRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfilesForRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListInstanceProfilesForRoleOutput) + return ret0, ret1 +} + +// ListInstanceProfilesForRoleRequest indicates an expected call of ListInstanceProfilesForRoleRequest. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesForRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesForRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesForRoleRequest), arg0) +} + +// ListInstanceProfilesForRoleWithContext mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesForRoleWithContext(arg0 aws.Context, arg1 *iam.ListInstanceProfilesForRoleInput, arg2 ...request.Option) (*iam.ListInstanceProfilesForRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListInstanceProfilesForRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListInstanceProfilesForRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListInstanceProfilesForRoleWithContext indicates an expected call of ListInstanceProfilesForRoleWithContext. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesForRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesForRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesForRoleWithContext), varargs...) +} + +// ListInstanceProfilesPages mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesPages(arg0 *iam.ListInstanceProfilesInput, arg1 func(*iam.ListInstanceProfilesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfilesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListInstanceProfilesPages indicates an expected call of ListInstanceProfilesPages. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesPages), arg0, arg1) +} + +// ListInstanceProfilesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesPagesWithContext(arg0 aws.Context, arg1 *iam.ListInstanceProfilesInput, arg2 func(*iam.ListInstanceProfilesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListInstanceProfilesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListInstanceProfilesPagesWithContext indicates an expected call of ListInstanceProfilesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesPagesWithContext), varargs...) +} + +// ListInstanceProfilesRequest mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesRequest(arg0 *iam.ListInstanceProfilesInput) (*request.Request, *iam.ListInstanceProfilesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListInstanceProfilesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListInstanceProfilesOutput) + return ret0, ret1 +} + +// ListInstanceProfilesRequest indicates an expected call of ListInstanceProfilesRequest. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesRequest), arg0) +} + +// ListInstanceProfilesWithContext mocks base method. +func (m *MockIAMAPI) ListInstanceProfilesWithContext(arg0 aws.Context, arg1 *iam.ListInstanceProfilesInput, arg2 ...request.Option) (*iam.ListInstanceProfilesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListInstanceProfilesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListInstanceProfilesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListInstanceProfilesWithContext indicates an expected call of ListInstanceProfilesWithContext. +func (mr *MockIAMAPIMockRecorder) ListInstanceProfilesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstanceProfilesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListInstanceProfilesWithContext), varargs...) +} + +// ListMFADeviceTags mocks base method. +func (m *MockIAMAPI) ListMFADeviceTags(arg0 *iam.ListMFADeviceTagsInput) (*iam.ListMFADeviceTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListMFADeviceTags", arg0) + ret0, _ := ret[0].(*iam.ListMFADeviceTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListMFADeviceTags indicates an expected call of ListMFADeviceTags. +func (mr *MockIAMAPIMockRecorder) ListMFADeviceTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADeviceTags", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADeviceTags), arg0) +} + +// ListMFADeviceTagsRequest mocks base method. +func (m *MockIAMAPI) ListMFADeviceTagsRequest(arg0 *iam.ListMFADeviceTagsInput) (*request.Request, *iam.ListMFADeviceTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListMFADeviceTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListMFADeviceTagsOutput) + return ret0, ret1 +} + +// ListMFADeviceTagsRequest indicates an expected call of ListMFADeviceTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListMFADeviceTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADeviceTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADeviceTagsRequest), arg0) +} + +// ListMFADeviceTagsWithContext mocks base method. +func (m *MockIAMAPI) ListMFADeviceTagsWithContext(arg0 aws.Context, arg1 *iam.ListMFADeviceTagsInput, arg2 ...request.Option) (*iam.ListMFADeviceTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListMFADeviceTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListMFADeviceTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListMFADeviceTagsWithContext indicates an expected call of ListMFADeviceTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListMFADeviceTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADeviceTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADeviceTagsWithContext), varargs...) +} + +// ListMFADevices mocks base method. +func (m *MockIAMAPI) ListMFADevices(arg0 *iam.ListMFADevicesInput) (*iam.ListMFADevicesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListMFADevices", arg0) + ret0, _ := ret[0].(*iam.ListMFADevicesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListMFADevices indicates an expected call of ListMFADevices. +func (mr *MockIAMAPIMockRecorder) ListMFADevices(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADevices", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADevices), arg0) +} + +// ListMFADevicesPages mocks base method. +func (m *MockIAMAPI) ListMFADevicesPages(arg0 *iam.ListMFADevicesInput, arg1 func(*iam.ListMFADevicesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListMFADevicesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListMFADevicesPages indicates an expected call of ListMFADevicesPages. +func (mr *MockIAMAPIMockRecorder) ListMFADevicesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADevicesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADevicesPages), arg0, arg1) +} + +// ListMFADevicesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListMFADevicesPagesWithContext(arg0 aws.Context, arg1 *iam.ListMFADevicesInput, arg2 func(*iam.ListMFADevicesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListMFADevicesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListMFADevicesPagesWithContext indicates an expected call of ListMFADevicesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListMFADevicesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADevicesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADevicesPagesWithContext), varargs...) +} + +// ListMFADevicesRequest mocks base method. +func (m *MockIAMAPI) ListMFADevicesRequest(arg0 *iam.ListMFADevicesInput) (*request.Request, *iam.ListMFADevicesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListMFADevicesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListMFADevicesOutput) + return ret0, ret1 +} + +// ListMFADevicesRequest indicates an expected call of ListMFADevicesRequest. +func (mr *MockIAMAPIMockRecorder) ListMFADevicesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADevicesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADevicesRequest), arg0) +} + +// ListMFADevicesWithContext mocks base method. +func (m *MockIAMAPI) ListMFADevicesWithContext(arg0 aws.Context, arg1 *iam.ListMFADevicesInput, arg2 ...request.Option) (*iam.ListMFADevicesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListMFADevicesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListMFADevicesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListMFADevicesWithContext indicates an expected call of ListMFADevicesWithContext. +func (mr *MockIAMAPIMockRecorder) ListMFADevicesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMFADevicesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListMFADevicesWithContext), varargs...) +} + +// ListOpenIDConnectProviderTags mocks base method. +func (m *MockIAMAPI) ListOpenIDConnectProviderTags(arg0 *iam.ListOpenIDConnectProviderTagsInput) (*iam.ListOpenIDConnectProviderTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListOpenIDConnectProviderTags", arg0) + ret0, _ := ret[0].(*iam.ListOpenIDConnectProviderTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListOpenIDConnectProviderTags indicates an expected call of ListOpenIDConnectProviderTags. +func (mr *MockIAMAPIMockRecorder) ListOpenIDConnectProviderTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOpenIDConnectProviderTags", reflect.TypeOf((*MockIAMAPI)(nil).ListOpenIDConnectProviderTags), arg0) +} + +// ListOpenIDConnectProviderTagsRequest mocks base method. +func (m *MockIAMAPI) ListOpenIDConnectProviderTagsRequest(arg0 *iam.ListOpenIDConnectProviderTagsInput) (*request.Request, *iam.ListOpenIDConnectProviderTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListOpenIDConnectProviderTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListOpenIDConnectProviderTagsOutput) + return ret0, ret1 +} + +// ListOpenIDConnectProviderTagsRequest indicates an expected call of ListOpenIDConnectProviderTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListOpenIDConnectProviderTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOpenIDConnectProviderTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListOpenIDConnectProviderTagsRequest), arg0) +} + +// ListOpenIDConnectProviderTagsWithContext mocks base method. +func (m *MockIAMAPI) ListOpenIDConnectProviderTagsWithContext(arg0 aws.Context, arg1 *iam.ListOpenIDConnectProviderTagsInput, arg2 ...request.Option) (*iam.ListOpenIDConnectProviderTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListOpenIDConnectProviderTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListOpenIDConnectProviderTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListOpenIDConnectProviderTagsWithContext indicates an expected call of ListOpenIDConnectProviderTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListOpenIDConnectProviderTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOpenIDConnectProviderTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListOpenIDConnectProviderTagsWithContext), varargs...) +} + +// ListOpenIDConnectProviders mocks base method. +func (m *MockIAMAPI) ListOpenIDConnectProviders(arg0 *iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListOpenIDConnectProviders", arg0) + ret0, _ := ret[0].(*iam.ListOpenIDConnectProvidersOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListOpenIDConnectProviders indicates an expected call of ListOpenIDConnectProviders. +func (mr *MockIAMAPIMockRecorder) ListOpenIDConnectProviders(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOpenIDConnectProviders", reflect.TypeOf((*MockIAMAPI)(nil).ListOpenIDConnectProviders), arg0) +} + +// ListOpenIDConnectProvidersRequest mocks base method. +func (m *MockIAMAPI) ListOpenIDConnectProvidersRequest(arg0 *iam.ListOpenIDConnectProvidersInput) (*request.Request, *iam.ListOpenIDConnectProvidersOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListOpenIDConnectProvidersRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListOpenIDConnectProvidersOutput) + return ret0, ret1 +} + +// ListOpenIDConnectProvidersRequest indicates an expected call of ListOpenIDConnectProvidersRequest. +func (mr *MockIAMAPIMockRecorder) ListOpenIDConnectProvidersRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOpenIDConnectProvidersRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListOpenIDConnectProvidersRequest), arg0) +} + +// ListOpenIDConnectProvidersWithContext mocks base method. +func (m *MockIAMAPI) ListOpenIDConnectProvidersWithContext(arg0 aws.Context, arg1 *iam.ListOpenIDConnectProvidersInput, arg2 ...request.Option) (*iam.ListOpenIDConnectProvidersOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListOpenIDConnectProvidersWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListOpenIDConnectProvidersOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListOpenIDConnectProvidersWithContext indicates an expected call of ListOpenIDConnectProvidersWithContext. +func (mr *MockIAMAPIMockRecorder) ListOpenIDConnectProvidersWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOpenIDConnectProvidersWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListOpenIDConnectProvidersWithContext), varargs...) +} + +// ListPolicies mocks base method. +func (m *MockIAMAPI) ListPolicies(arg0 *iam.ListPoliciesInput) (*iam.ListPoliciesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicies", arg0) + ret0, _ := ret[0].(*iam.ListPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicies indicates an expected call of ListPolicies. +func (mr *MockIAMAPIMockRecorder) ListPolicies(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicies", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicies), arg0) +} + +// ListPoliciesGrantingServiceAccess mocks base method. +func (m *MockIAMAPI) ListPoliciesGrantingServiceAccess(arg0 *iam.ListPoliciesGrantingServiceAccessInput) (*iam.ListPoliciesGrantingServiceAccessOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPoliciesGrantingServiceAccess", arg0) + ret0, _ := ret[0].(*iam.ListPoliciesGrantingServiceAccessOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPoliciesGrantingServiceAccess indicates an expected call of ListPoliciesGrantingServiceAccess. +func (mr *MockIAMAPIMockRecorder) ListPoliciesGrantingServiceAccess(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPoliciesGrantingServiceAccess", reflect.TypeOf((*MockIAMAPI)(nil).ListPoliciesGrantingServiceAccess), arg0) +} + +// ListPoliciesGrantingServiceAccessRequest mocks base method. +func (m *MockIAMAPI) ListPoliciesGrantingServiceAccessRequest(arg0 *iam.ListPoliciesGrantingServiceAccessInput) (*request.Request, *iam.ListPoliciesGrantingServiceAccessOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPoliciesGrantingServiceAccessRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListPoliciesGrantingServiceAccessOutput) + return ret0, ret1 +} + +// ListPoliciesGrantingServiceAccessRequest indicates an expected call of ListPoliciesGrantingServiceAccessRequest. +func (mr *MockIAMAPIMockRecorder) ListPoliciesGrantingServiceAccessRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPoliciesGrantingServiceAccessRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListPoliciesGrantingServiceAccessRequest), arg0) +} + +// ListPoliciesGrantingServiceAccessWithContext mocks base method. +func (m *MockIAMAPI) ListPoliciesGrantingServiceAccessWithContext(arg0 aws.Context, arg1 *iam.ListPoliciesGrantingServiceAccessInput, arg2 ...request.Option) (*iam.ListPoliciesGrantingServiceAccessOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPoliciesGrantingServiceAccessWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListPoliciesGrantingServiceAccessOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPoliciesGrantingServiceAccessWithContext indicates an expected call of ListPoliciesGrantingServiceAccessWithContext. +func (mr *MockIAMAPIMockRecorder) ListPoliciesGrantingServiceAccessWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPoliciesGrantingServiceAccessWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListPoliciesGrantingServiceAccessWithContext), varargs...) +} + +// ListPoliciesPages mocks base method. +func (m *MockIAMAPI) ListPoliciesPages(arg0 *iam.ListPoliciesInput, arg1 func(*iam.ListPoliciesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPoliciesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListPoliciesPages indicates an expected call of ListPoliciesPages. +func (mr *MockIAMAPIMockRecorder) ListPoliciesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPoliciesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListPoliciesPages), arg0, arg1) +} + +// ListPoliciesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListPoliciesPagesWithContext(arg0 aws.Context, arg1 *iam.ListPoliciesInput, arg2 func(*iam.ListPoliciesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPoliciesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListPoliciesPagesWithContext indicates an expected call of ListPoliciesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListPoliciesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPoliciesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListPoliciesPagesWithContext), varargs...) +} + +// ListPoliciesRequest mocks base method. +func (m *MockIAMAPI) ListPoliciesRequest(arg0 *iam.ListPoliciesInput) (*request.Request, *iam.ListPoliciesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPoliciesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListPoliciesOutput) + return ret0, ret1 +} + +// ListPoliciesRequest indicates an expected call of ListPoliciesRequest. +func (mr *MockIAMAPIMockRecorder) ListPoliciesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPoliciesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListPoliciesRequest), arg0) +} + +// ListPoliciesWithContext mocks base method. +func (m *MockIAMAPI) ListPoliciesWithContext(arg0 aws.Context, arg1 *iam.ListPoliciesInput, arg2 ...request.Option) (*iam.ListPoliciesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPoliciesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPoliciesWithContext indicates an expected call of ListPoliciesWithContext. +func (mr *MockIAMAPIMockRecorder) ListPoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPoliciesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListPoliciesWithContext), varargs...) +} + +// ListPolicyTags mocks base method. +func (m *MockIAMAPI) ListPolicyTags(arg0 *iam.ListPolicyTagsInput) (*iam.ListPolicyTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicyTags", arg0) + ret0, _ := ret[0].(*iam.ListPolicyTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicyTags indicates an expected call of ListPolicyTags. +func (mr *MockIAMAPIMockRecorder) ListPolicyTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyTags", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyTags), arg0) +} + +// ListPolicyTagsRequest mocks base method. +func (m *MockIAMAPI) ListPolicyTagsRequest(arg0 *iam.ListPolicyTagsInput) (*request.Request, *iam.ListPolicyTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicyTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListPolicyTagsOutput) + return ret0, ret1 +} + +// ListPolicyTagsRequest indicates an expected call of ListPolicyTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListPolicyTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyTagsRequest), arg0) +} + +// ListPolicyTagsWithContext mocks base method. +func (m *MockIAMAPI) ListPolicyTagsWithContext(arg0 aws.Context, arg1 *iam.ListPolicyTagsInput, arg2 ...request.Option) (*iam.ListPolicyTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPolicyTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListPolicyTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicyTagsWithContext indicates an expected call of ListPolicyTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListPolicyTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyTagsWithContext), varargs...) +} + +// ListPolicyVersions mocks base method. +func (m *MockIAMAPI) ListPolicyVersions(arg0 *iam.ListPolicyVersionsInput) (*iam.ListPolicyVersionsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicyVersions", arg0) + ret0, _ := ret[0].(*iam.ListPolicyVersionsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicyVersions indicates an expected call of ListPolicyVersions. +func (mr *MockIAMAPIMockRecorder) ListPolicyVersions(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyVersions", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyVersions), arg0) +} + +// ListPolicyVersionsPages mocks base method. +func (m *MockIAMAPI) ListPolicyVersionsPages(arg0 *iam.ListPolicyVersionsInput, arg1 func(*iam.ListPolicyVersionsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicyVersionsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListPolicyVersionsPages indicates an expected call of ListPolicyVersionsPages. +func (mr *MockIAMAPIMockRecorder) ListPolicyVersionsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyVersionsPages", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyVersionsPages), arg0, arg1) +} + +// ListPolicyVersionsPagesWithContext mocks base method. +func (m *MockIAMAPI) ListPolicyVersionsPagesWithContext(arg0 aws.Context, arg1 *iam.ListPolicyVersionsInput, arg2 func(*iam.ListPolicyVersionsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPolicyVersionsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListPolicyVersionsPagesWithContext indicates an expected call of ListPolicyVersionsPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListPolicyVersionsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyVersionsPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyVersionsPagesWithContext), varargs...) +} + +// ListPolicyVersionsRequest mocks base method. +func (m *MockIAMAPI) ListPolicyVersionsRequest(arg0 *iam.ListPolicyVersionsInput) (*request.Request, *iam.ListPolicyVersionsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicyVersionsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListPolicyVersionsOutput) + return ret0, ret1 +} + +// ListPolicyVersionsRequest indicates an expected call of ListPolicyVersionsRequest. +func (mr *MockIAMAPIMockRecorder) ListPolicyVersionsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyVersionsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyVersionsRequest), arg0) +} + +// ListPolicyVersionsWithContext mocks base method. +func (m *MockIAMAPI) ListPolicyVersionsWithContext(arg0 aws.Context, arg1 *iam.ListPolicyVersionsInput, arg2 ...request.Option) (*iam.ListPolicyVersionsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPolicyVersionsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListPolicyVersionsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicyVersionsWithContext indicates an expected call of ListPolicyVersionsWithContext. +func (mr *MockIAMAPIMockRecorder) ListPolicyVersionsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyVersionsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListPolicyVersionsWithContext), varargs...) +} + +// ListRolePolicies mocks base method. +func (m *MockIAMAPI) ListRolePolicies(arg0 *iam.ListRolePoliciesInput) (*iam.ListRolePoliciesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRolePolicies", arg0) + ret0, _ := ret[0].(*iam.ListRolePoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRolePolicies indicates an expected call of ListRolePolicies. +func (mr *MockIAMAPIMockRecorder) ListRolePolicies(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolePolicies", reflect.TypeOf((*MockIAMAPI)(nil).ListRolePolicies), arg0) +} + +// ListRolePoliciesPages mocks base method. +func (m *MockIAMAPI) ListRolePoliciesPages(arg0 *iam.ListRolePoliciesInput, arg1 func(*iam.ListRolePoliciesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRolePoliciesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListRolePoliciesPages indicates an expected call of ListRolePoliciesPages. +func (mr *MockIAMAPIMockRecorder) ListRolePoliciesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolePoliciesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListRolePoliciesPages), arg0, arg1) +} + +// ListRolePoliciesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListRolePoliciesPagesWithContext(arg0 aws.Context, arg1 *iam.ListRolePoliciesInput, arg2 func(*iam.ListRolePoliciesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListRolePoliciesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListRolePoliciesPagesWithContext indicates an expected call of ListRolePoliciesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListRolePoliciesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolePoliciesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListRolePoliciesPagesWithContext), varargs...) +} + +// ListRolePoliciesRequest mocks base method. +func (m *MockIAMAPI) ListRolePoliciesRequest(arg0 *iam.ListRolePoliciesInput) (*request.Request, *iam.ListRolePoliciesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRolePoliciesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListRolePoliciesOutput) + return ret0, ret1 +} + +// ListRolePoliciesRequest indicates an expected call of ListRolePoliciesRequest. +func (mr *MockIAMAPIMockRecorder) ListRolePoliciesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolePoliciesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListRolePoliciesRequest), arg0) +} + +// ListRolePoliciesWithContext mocks base method. +func (m *MockIAMAPI) ListRolePoliciesWithContext(arg0 aws.Context, arg1 *iam.ListRolePoliciesInput, arg2 ...request.Option) (*iam.ListRolePoliciesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListRolePoliciesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListRolePoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRolePoliciesWithContext indicates an expected call of ListRolePoliciesWithContext. +func (mr *MockIAMAPIMockRecorder) ListRolePoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolePoliciesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListRolePoliciesWithContext), varargs...) +} + +// ListRoleTags mocks base method. +func (m *MockIAMAPI) ListRoleTags(arg0 *iam.ListRoleTagsInput) (*iam.ListRoleTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRoleTags", arg0) + ret0, _ := ret[0].(*iam.ListRoleTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRoleTags indicates an expected call of ListRoleTags. +func (mr *MockIAMAPIMockRecorder) ListRoleTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoleTags", reflect.TypeOf((*MockIAMAPI)(nil).ListRoleTags), arg0) +} + +// ListRoleTagsRequest mocks base method. +func (m *MockIAMAPI) ListRoleTagsRequest(arg0 *iam.ListRoleTagsInput) (*request.Request, *iam.ListRoleTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRoleTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListRoleTagsOutput) + return ret0, ret1 +} + +// ListRoleTagsRequest indicates an expected call of ListRoleTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListRoleTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoleTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListRoleTagsRequest), arg0) +} + +// ListRoleTagsWithContext mocks base method. +func (m *MockIAMAPI) ListRoleTagsWithContext(arg0 aws.Context, arg1 *iam.ListRoleTagsInput, arg2 ...request.Option) (*iam.ListRoleTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListRoleTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListRoleTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRoleTagsWithContext indicates an expected call of ListRoleTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListRoleTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoleTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListRoleTagsWithContext), varargs...) +} + +// ListRoles mocks base method. +func (m *MockIAMAPI) ListRoles(arg0 *iam.ListRolesInput) (*iam.ListRolesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRoles", arg0) + ret0, _ := ret[0].(*iam.ListRolesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRoles indicates an expected call of ListRoles. +func (mr *MockIAMAPIMockRecorder) ListRoles(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoles", reflect.TypeOf((*MockIAMAPI)(nil).ListRoles), arg0) +} + +// ListRolesPages mocks base method. +func (m *MockIAMAPI) ListRolesPages(arg0 *iam.ListRolesInput, arg1 func(*iam.ListRolesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRolesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListRolesPages indicates an expected call of ListRolesPages. +func (mr *MockIAMAPIMockRecorder) ListRolesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListRolesPages), arg0, arg1) +} + +// ListRolesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListRolesPagesWithContext(arg0 aws.Context, arg1 *iam.ListRolesInput, arg2 func(*iam.ListRolesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListRolesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListRolesPagesWithContext indicates an expected call of ListRolesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListRolesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListRolesPagesWithContext), varargs...) +} + +// ListRolesRequest mocks base method. +func (m *MockIAMAPI) ListRolesRequest(arg0 *iam.ListRolesInput) (*request.Request, *iam.ListRolesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRolesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListRolesOutput) + return ret0, ret1 +} + +// ListRolesRequest indicates an expected call of ListRolesRequest. +func (mr *MockIAMAPIMockRecorder) ListRolesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListRolesRequest), arg0) +} + +// ListRolesWithContext mocks base method. +func (m *MockIAMAPI) ListRolesWithContext(arg0 aws.Context, arg1 *iam.ListRolesInput, arg2 ...request.Option) (*iam.ListRolesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListRolesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListRolesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRolesWithContext indicates an expected call of ListRolesWithContext. +func (mr *MockIAMAPIMockRecorder) ListRolesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRolesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListRolesWithContext), varargs...) +} + +// ListSAMLProviderTags mocks base method. +func (m *MockIAMAPI) ListSAMLProviderTags(arg0 *iam.ListSAMLProviderTagsInput) (*iam.ListSAMLProviderTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSAMLProviderTags", arg0) + ret0, _ := ret[0].(*iam.ListSAMLProviderTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSAMLProviderTags indicates an expected call of ListSAMLProviderTags. +func (mr *MockIAMAPIMockRecorder) ListSAMLProviderTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSAMLProviderTags", reflect.TypeOf((*MockIAMAPI)(nil).ListSAMLProviderTags), arg0) +} + +// ListSAMLProviderTagsRequest mocks base method. +func (m *MockIAMAPI) ListSAMLProviderTagsRequest(arg0 *iam.ListSAMLProviderTagsInput) (*request.Request, *iam.ListSAMLProviderTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSAMLProviderTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListSAMLProviderTagsOutput) + return ret0, ret1 +} + +// ListSAMLProviderTagsRequest indicates an expected call of ListSAMLProviderTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListSAMLProviderTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSAMLProviderTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListSAMLProviderTagsRequest), arg0) +} + +// ListSAMLProviderTagsWithContext mocks base method. +func (m *MockIAMAPI) ListSAMLProviderTagsWithContext(arg0 aws.Context, arg1 *iam.ListSAMLProviderTagsInput, arg2 ...request.Option) (*iam.ListSAMLProviderTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListSAMLProviderTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListSAMLProviderTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSAMLProviderTagsWithContext indicates an expected call of ListSAMLProviderTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListSAMLProviderTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSAMLProviderTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListSAMLProviderTagsWithContext), varargs...) +} + +// ListSAMLProviders mocks base method. +func (m *MockIAMAPI) ListSAMLProviders(arg0 *iam.ListSAMLProvidersInput) (*iam.ListSAMLProvidersOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSAMLProviders", arg0) + ret0, _ := ret[0].(*iam.ListSAMLProvidersOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSAMLProviders indicates an expected call of ListSAMLProviders. +func (mr *MockIAMAPIMockRecorder) ListSAMLProviders(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSAMLProviders", reflect.TypeOf((*MockIAMAPI)(nil).ListSAMLProviders), arg0) +} + +// ListSAMLProvidersRequest mocks base method. +func (m *MockIAMAPI) ListSAMLProvidersRequest(arg0 *iam.ListSAMLProvidersInput) (*request.Request, *iam.ListSAMLProvidersOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSAMLProvidersRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListSAMLProvidersOutput) + return ret0, ret1 +} + +// ListSAMLProvidersRequest indicates an expected call of ListSAMLProvidersRequest. +func (mr *MockIAMAPIMockRecorder) ListSAMLProvidersRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSAMLProvidersRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListSAMLProvidersRequest), arg0) +} + +// ListSAMLProvidersWithContext mocks base method. +func (m *MockIAMAPI) ListSAMLProvidersWithContext(arg0 aws.Context, arg1 *iam.ListSAMLProvidersInput, arg2 ...request.Option) (*iam.ListSAMLProvidersOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListSAMLProvidersWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListSAMLProvidersOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSAMLProvidersWithContext indicates an expected call of ListSAMLProvidersWithContext. +func (mr *MockIAMAPIMockRecorder) ListSAMLProvidersWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSAMLProvidersWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListSAMLProvidersWithContext), varargs...) +} + +// ListSSHPublicKeys mocks base method. +func (m *MockIAMAPI) ListSSHPublicKeys(arg0 *iam.ListSSHPublicKeysInput) (*iam.ListSSHPublicKeysOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSSHPublicKeys", arg0) + ret0, _ := ret[0].(*iam.ListSSHPublicKeysOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSSHPublicKeys indicates an expected call of ListSSHPublicKeys. +func (mr *MockIAMAPIMockRecorder) ListSSHPublicKeys(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSSHPublicKeys", reflect.TypeOf((*MockIAMAPI)(nil).ListSSHPublicKeys), arg0) +} + +// ListSSHPublicKeysPages mocks base method. +func (m *MockIAMAPI) ListSSHPublicKeysPages(arg0 *iam.ListSSHPublicKeysInput, arg1 func(*iam.ListSSHPublicKeysOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSSHPublicKeysPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListSSHPublicKeysPages indicates an expected call of ListSSHPublicKeysPages. +func (mr *MockIAMAPIMockRecorder) ListSSHPublicKeysPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSSHPublicKeysPages", reflect.TypeOf((*MockIAMAPI)(nil).ListSSHPublicKeysPages), arg0, arg1) +} + +// ListSSHPublicKeysPagesWithContext mocks base method. +func (m *MockIAMAPI) ListSSHPublicKeysPagesWithContext(arg0 aws.Context, arg1 *iam.ListSSHPublicKeysInput, arg2 func(*iam.ListSSHPublicKeysOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListSSHPublicKeysPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListSSHPublicKeysPagesWithContext indicates an expected call of ListSSHPublicKeysPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListSSHPublicKeysPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSSHPublicKeysPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListSSHPublicKeysPagesWithContext), varargs...) +} + +// ListSSHPublicKeysRequest mocks base method. +func (m *MockIAMAPI) ListSSHPublicKeysRequest(arg0 *iam.ListSSHPublicKeysInput) (*request.Request, *iam.ListSSHPublicKeysOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSSHPublicKeysRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListSSHPublicKeysOutput) + return ret0, ret1 +} + +// ListSSHPublicKeysRequest indicates an expected call of ListSSHPublicKeysRequest. +func (mr *MockIAMAPIMockRecorder) ListSSHPublicKeysRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSSHPublicKeysRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListSSHPublicKeysRequest), arg0) +} + +// ListSSHPublicKeysWithContext mocks base method. +func (m *MockIAMAPI) ListSSHPublicKeysWithContext(arg0 aws.Context, arg1 *iam.ListSSHPublicKeysInput, arg2 ...request.Option) (*iam.ListSSHPublicKeysOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListSSHPublicKeysWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListSSHPublicKeysOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSSHPublicKeysWithContext indicates an expected call of ListSSHPublicKeysWithContext. +func (mr *MockIAMAPIMockRecorder) ListSSHPublicKeysWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSSHPublicKeysWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListSSHPublicKeysWithContext), varargs...) +} + +// ListServerCertificateTags mocks base method. +func (m *MockIAMAPI) ListServerCertificateTags(arg0 *iam.ListServerCertificateTagsInput) (*iam.ListServerCertificateTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListServerCertificateTags", arg0) + ret0, _ := ret[0].(*iam.ListServerCertificateTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListServerCertificateTags indicates an expected call of ListServerCertificateTags. +func (mr *MockIAMAPIMockRecorder) ListServerCertificateTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificateTags", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificateTags), arg0) +} + +// ListServerCertificateTagsRequest mocks base method. +func (m *MockIAMAPI) ListServerCertificateTagsRequest(arg0 *iam.ListServerCertificateTagsInput) (*request.Request, *iam.ListServerCertificateTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListServerCertificateTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListServerCertificateTagsOutput) + return ret0, ret1 +} + +// ListServerCertificateTagsRequest indicates an expected call of ListServerCertificateTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListServerCertificateTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificateTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificateTagsRequest), arg0) +} + +// ListServerCertificateTagsWithContext mocks base method. +func (m *MockIAMAPI) ListServerCertificateTagsWithContext(arg0 aws.Context, arg1 *iam.ListServerCertificateTagsInput, arg2 ...request.Option) (*iam.ListServerCertificateTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListServerCertificateTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListServerCertificateTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListServerCertificateTagsWithContext indicates an expected call of ListServerCertificateTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListServerCertificateTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificateTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificateTagsWithContext), varargs...) +} + +// ListServerCertificates mocks base method. +func (m *MockIAMAPI) ListServerCertificates(arg0 *iam.ListServerCertificatesInput) (*iam.ListServerCertificatesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListServerCertificates", arg0) + ret0, _ := ret[0].(*iam.ListServerCertificatesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListServerCertificates indicates an expected call of ListServerCertificates. +func (mr *MockIAMAPIMockRecorder) ListServerCertificates(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificates", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificates), arg0) +} + +// ListServerCertificatesPages mocks base method. +func (m *MockIAMAPI) ListServerCertificatesPages(arg0 *iam.ListServerCertificatesInput, arg1 func(*iam.ListServerCertificatesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListServerCertificatesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListServerCertificatesPages indicates an expected call of ListServerCertificatesPages. +func (mr *MockIAMAPIMockRecorder) ListServerCertificatesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificatesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificatesPages), arg0, arg1) +} + +// ListServerCertificatesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListServerCertificatesPagesWithContext(arg0 aws.Context, arg1 *iam.ListServerCertificatesInput, arg2 func(*iam.ListServerCertificatesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListServerCertificatesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListServerCertificatesPagesWithContext indicates an expected call of ListServerCertificatesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListServerCertificatesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificatesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificatesPagesWithContext), varargs...) +} + +// ListServerCertificatesRequest mocks base method. +func (m *MockIAMAPI) ListServerCertificatesRequest(arg0 *iam.ListServerCertificatesInput) (*request.Request, *iam.ListServerCertificatesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListServerCertificatesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListServerCertificatesOutput) + return ret0, ret1 +} + +// ListServerCertificatesRequest indicates an expected call of ListServerCertificatesRequest. +func (mr *MockIAMAPIMockRecorder) ListServerCertificatesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificatesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificatesRequest), arg0) +} + +// ListServerCertificatesWithContext mocks base method. +func (m *MockIAMAPI) ListServerCertificatesWithContext(arg0 aws.Context, arg1 *iam.ListServerCertificatesInput, arg2 ...request.Option) (*iam.ListServerCertificatesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListServerCertificatesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListServerCertificatesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListServerCertificatesWithContext indicates an expected call of ListServerCertificatesWithContext. +func (mr *MockIAMAPIMockRecorder) ListServerCertificatesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServerCertificatesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListServerCertificatesWithContext), varargs...) +} + +// ListServiceSpecificCredentials mocks base method. +func (m *MockIAMAPI) ListServiceSpecificCredentials(arg0 *iam.ListServiceSpecificCredentialsInput) (*iam.ListServiceSpecificCredentialsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListServiceSpecificCredentials", arg0) + ret0, _ := ret[0].(*iam.ListServiceSpecificCredentialsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListServiceSpecificCredentials indicates an expected call of ListServiceSpecificCredentials. +func (mr *MockIAMAPIMockRecorder) ListServiceSpecificCredentials(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServiceSpecificCredentials", reflect.TypeOf((*MockIAMAPI)(nil).ListServiceSpecificCredentials), arg0) +} + +// ListServiceSpecificCredentialsRequest mocks base method. +func (m *MockIAMAPI) ListServiceSpecificCredentialsRequest(arg0 *iam.ListServiceSpecificCredentialsInput) (*request.Request, *iam.ListServiceSpecificCredentialsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListServiceSpecificCredentialsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListServiceSpecificCredentialsOutput) + return ret0, ret1 +} + +// ListServiceSpecificCredentialsRequest indicates an expected call of ListServiceSpecificCredentialsRequest. +func (mr *MockIAMAPIMockRecorder) ListServiceSpecificCredentialsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServiceSpecificCredentialsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListServiceSpecificCredentialsRequest), arg0) +} + +// ListServiceSpecificCredentialsWithContext mocks base method. +func (m *MockIAMAPI) ListServiceSpecificCredentialsWithContext(arg0 aws.Context, arg1 *iam.ListServiceSpecificCredentialsInput, arg2 ...request.Option) (*iam.ListServiceSpecificCredentialsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListServiceSpecificCredentialsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListServiceSpecificCredentialsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListServiceSpecificCredentialsWithContext indicates an expected call of ListServiceSpecificCredentialsWithContext. +func (mr *MockIAMAPIMockRecorder) ListServiceSpecificCredentialsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListServiceSpecificCredentialsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListServiceSpecificCredentialsWithContext), varargs...) +} + +// ListSigningCertificates mocks base method. +func (m *MockIAMAPI) ListSigningCertificates(arg0 *iam.ListSigningCertificatesInput) (*iam.ListSigningCertificatesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSigningCertificates", arg0) + ret0, _ := ret[0].(*iam.ListSigningCertificatesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSigningCertificates indicates an expected call of ListSigningCertificates. +func (mr *MockIAMAPIMockRecorder) ListSigningCertificates(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSigningCertificates", reflect.TypeOf((*MockIAMAPI)(nil).ListSigningCertificates), arg0) +} + +// ListSigningCertificatesPages mocks base method. +func (m *MockIAMAPI) ListSigningCertificatesPages(arg0 *iam.ListSigningCertificatesInput, arg1 func(*iam.ListSigningCertificatesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSigningCertificatesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListSigningCertificatesPages indicates an expected call of ListSigningCertificatesPages. +func (mr *MockIAMAPIMockRecorder) ListSigningCertificatesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSigningCertificatesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListSigningCertificatesPages), arg0, arg1) +} + +// ListSigningCertificatesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListSigningCertificatesPagesWithContext(arg0 aws.Context, arg1 *iam.ListSigningCertificatesInput, arg2 func(*iam.ListSigningCertificatesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListSigningCertificatesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListSigningCertificatesPagesWithContext indicates an expected call of ListSigningCertificatesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListSigningCertificatesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSigningCertificatesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListSigningCertificatesPagesWithContext), varargs...) +} + +// ListSigningCertificatesRequest mocks base method. +func (m *MockIAMAPI) ListSigningCertificatesRequest(arg0 *iam.ListSigningCertificatesInput) (*request.Request, *iam.ListSigningCertificatesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSigningCertificatesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListSigningCertificatesOutput) + return ret0, ret1 +} + +// ListSigningCertificatesRequest indicates an expected call of ListSigningCertificatesRequest. +func (mr *MockIAMAPIMockRecorder) ListSigningCertificatesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSigningCertificatesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListSigningCertificatesRequest), arg0) +} + +// ListSigningCertificatesWithContext mocks base method. +func (m *MockIAMAPI) ListSigningCertificatesWithContext(arg0 aws.Context, arg1 *iam.ListSigningCertificatesInput, arg2 ...request.Option) (*iam.ListSigningCertificatesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListSigningCertificatesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListSigningCertificatesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSigningCertificatesWithContext indicates an expected call of ListSigningCertificatesWithContext. +func (mr *MockIAMAPIMockRecorder) ListSigningCertificatesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSigningCertificatesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListSigningCertificatesWithContext), varargs...) +} + +// ListUserPolicies mocks base method. +func (m *MockIAMAPI) ListUserPolicies(arg0 *iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserPolicies", arg0) + ret0, _ := ret[0].(*iam.ListUserPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUserPolicies indicates an expected call of ListUserPolicies. +func (mr *MockIAMAPIMockRecorder) ListUserPolicies(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserPolicies", reflect.TypeOf((*MockIAMAPI)(nil).ListUserPolicies), arg0) +} + +// ListUserPoliciesPages mocks base method. +func (m *MockIAMAPI) ListUserPoliciesPages(arg0 *iam.ListUserPoliciesInput, arg1 func(*iam.ListUserPoliciesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserPoliciesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListUserPoliciesPages indicates an expected call of ListUserPoliciesPages. +func (mr *MockIAMAPIMockRecorder) ListUserPoliciesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserPoliciesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListUserPoliciesPages), arg0, arg1) +} + +// ListUserPoliciesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListUserPoliciesPagesWithContext(arg0 aws.Context, arg1 *iam.ListUserPoliciesInput, arg2 func(*iam.ListUserPoliciesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListUserPoliciesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListUserPoliciesPagesWithContext indicates an expected call of ListUserPoliciesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListUserPoliciesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserPoliciesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListUserPoliciesPagesWithContext), varargs...) +} + +// ListUserPoliciesRequest mocks base method. +func (m *MockIAMAPI) ListUserPoliciesRequest(arg0 *iam.ListUserPoliciesInput) (*request.Request, *iam.ListUserPoliciesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserPoliciesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListUserPoliciesOutput) + return ret0, ret1 +} + +// ListUserPoliciesRequest indicates an expected call of ListUserPoliciesRequest. +func (mr *MockIAMAPIMockRecorder) ListUserPoliciesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserPoliciesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListUserPoliciesRequest), arg0) +} + +// ListUserPoliciesWithContext mocks base method. +func (m *MockIAMAPI) ListUserPoliciesWithContext(arg0 aws.Context, arg1 *iam.ListUserPoliciesInput, arg2 ...request.Option) (*iam.ListUserPoliciesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListUserPoliciesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListUserPoliciesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUserPoliciesWithContext indicates an expected call of ListUserPoliciesWithContext. +func (mr *MockIAMAPIMockRecorder) ListUserPoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserPoliciesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListUserPoliciesWithContext), varargs...) +} + +// ListUserTags mocks base method. +func (m *MockIAMAPI) ListUserTags(arg0 *iam.ListUserTagsInput) (*iam.ListUserTagsOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserTags", arg0) + ret0, _ := ret[0].(*iam.ListUserTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUserTags indicates an expected call of ListUserTags. +func (mr *MockIAMAPIMockRecorder) ListUserTags(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserTags", reflect.TypeOf((*MockIAMAPI)(nil).ListUserTags), arg0) +} + +// ListUserTagsPages mocks base method. +func (m *MockIAMAPI) ListUserTagsPages(arg0 *iam.ListUserTagsInput, arg1 func(*iam.ListUserTagsOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserTagsPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListUserTagsPages indicates an expected call of ListUserTagsPages. +func (mr *MockIAMAPIMockRecorder) ListUserTagsPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserTagsPages", reflect.TypeOf((*MockIAMAPI)(nil).ListUserTagsPages), arg0, arg1) +} + +// ListUserTagsPagesWithContext mocks base method. +func (m *MockIAMAPI) ListUserTagsPagesWithContext(arg0 aws.Context, arg1 *iam.ListUserTagsInput, arg2 func(*iam.ListUserTagsOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListUserTagsPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListUserTagsPagesWithContext indicates an expected call of ListUserTagsPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListUserTagsPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserTagsPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListUserTagsPagesWithContext), varargs...) +} + +// ListUserTagsRequest mocks base method. +func (m *MockIAMAPI) ListUserTagsRequest(arg0 *iam.ListUserTagsInput) (*request.Request, *iam.ListUserTagsOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUserTagsRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListUserTagsOutput) + return ret0, ret1 +} + +// ListUserTagsRequest indicates an expected call of ListUserTagsRequest. +func (mr *MockIAMAPIMockRecorder) ListUserTagsRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserTagsRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListUserTagsRequest), arg0) +} + +// ListUserTagsWithContext mocks base method. +func (m *MockIAMAPI) ListUserTagsWithContext(arg0 aws.Context, arg1 *iam.ListUserTagsInput, arg2 ...request.Option) (*iam.ListUserTagsOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListUserTagsWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListUserTagsOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUserTagsWithContext indicates an expected call of ListUserTagsWithContext. +func (mr *MockIAMAPIMockRecorder) ListUserTagsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUserTagsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListUserTagsWithContext), varargs...) +} + +// ListUsers mocks base method. +func (m *MockIAMAPI) ListUsers(arg0 *iam.ListUsersInput) (*iam.ListUsersOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUsers", arg0) + ret0, _ := ret[0].(*iam.ListUsersOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUsers indicates an expected call of ListUsers. +func (mr *MockIAMAPIMockRecorder) ListUsers(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUsers", reflect.TypeOf((*MockIAMAPI)(nil).ListUsers), arg0) +} + +// ListUsersPages mocks base method. +func (m *MockIAMAPI) ListUsersPages(arg0 *iam.ListUsersInput, arg1 func(*iam.ListUsersOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUsersPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListUsersPages indicates an expected call of ListUsersPages. +func (mr *MockIAMAPIMockRecorder) ListUsersPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUsersPages", reflect.TypeOf((*MockIAMAPI)(nil).ListUsersPages), arg0, arg1) +} + +// ListUsersPagesWithContext mocks base method. +func (m *MockIAMAPI) ListUsersPagesWithContext(arg0 aws.Context, arg1 *iam.ListUsersInput, arg2 func(*iam.ListUsersOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListUsersPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListUsersPagesWithContext indicates an expected call of ListUsersPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListUsersPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUsersPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListUsersPagesWithContext), varargs...) +} + +// ListUsersRequest mocks base method. +func (m *MockIAMAPI) ListUsersRequest(arg0 *iam.ListUsersInput) (*request.Request, *iam.ListUsersOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListUsersRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListUsersOutput) + return ret0, ret1 +} + +// ListUsersRequest indicates an expected call of ListUsersRequest. +func (mr *MockIAMAPIMockRecorder) ListUsersRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUsersRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListUsersRequest), arg0) +} + +// ListUsersWithContext mocks base method. +func (m *MockIAMAPI) ListUsersWithContext(arg0 aws.Context, arg1 *iam.ListUsersInput, arg2 ...request.Option) (*iam.ListUsersOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListUsersWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListUsersOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListUsersWithContext indicates an expected call of ListUsersWithContext. +func (mr *MockIAMAPIMockRecorder) ListUsersWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListUsersWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListUsersWithContext), varargs...) +} + +// ListVirtualMFADevices mocks base method. +func (m *MockIAMAPI) ListVirtualMFADevices(arg0 *iam.ListVirtualMFADevicesInput) (*iam.ListVirtualMFADevicesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListVirtualMFADevices", arg0) + ret0, _ := ret[0].(*iam.ListVirtualMFADevicesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListVirtualMFADevices indicates an expected call of ListVirtualMFADevices. +func (mr *MockIAMAPIMockRecorder) ListVirtualMFADevices(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVirtualMFADevices", reflect.TypeOf((*MockIAMAPI)(nil).ListVirtualMFADevices), arg0) +} + +// ListVirtualMFADevicesPages mocks base method. +func (m *MockIAMAPI) ListVirtualMFADevicesPages(arg0 *iam.ListVirtualMFADevicesInput, arg1 func(*iam.ListVirtualMFADevicesOutput, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListVirtualMFADevicesPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListVirtualMFADevicesPages indicates an expected call of ListVirtualMFADevicesPages. +func (mr *MockIAMAPIMockRecorder) ListVirtualMFADevicesPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVirtualMFADevicesPages", reflect.TypeOf((*MockIAMAPI)(nil).ListVirtualMFADevicesPages), arg0, arg1) +} + +// ListVirtualMFADevicesPagesWithContext mocks base method. +func (m *MockIAMAPI) ListVirtualMFADevicesPagesWithContext(arg0 aws.Context, arg1 *iam.ListVirtualMFADevicesInput, arg2 func(*iam.ListVirtualMFADevicesOutput, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListVirtualMFADevicesPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// ListVirtualMFADevicesPagesWithContext indicates an expected call of ListVirtualMFADevicesPagesWithContext. +func (mr *MockIAMAPIMockRecorder) ListVirtualMFADevicesPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVirtualMFADevicesPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListVirtualMFADevicesPagesWithContext), varargs...) +} + +// ListVirtualMFADevicesRequest mocks base method. +func (m *MockIAMAPI) ListVirtualMFADevicesRequest(arg0 *iam.ListVirtualMFADevicesInput) (*request.Request, *iam.ListVirtualMFADevicesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListVirtualMFADevicesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ListVirtualMFADevicesOutput) + return ret0, ret1 +} + +// ListVirtualMFADevicesRequest indicates an expected call of ListVirtualMFADevicesRequest. +func (mr *MockIAMAPIMockRecorder) ListVirtualMFADevicesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVirtualMFADevicesRequest", reflect.TypeOf((*MockIAMAPI)(nil).ListVirtualMFADevicesRequest), arg0) +} + +// ListVirtualMFADevicesWithContext mocks base method. +func (m *MockIAMAPI) ListVirtualMFADevicesWithContext(arg0 aws.Context, arg1 *iam.ListVirtualMFADevicesInput, arg2 ...request.Option) (*iam.ListVirtualMFADevicesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListVirtualMFADevicesWithContext", varargs...) + ret0, _ := ret[0].(*iam.ListVirtualMFADevicesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListVirtualMFADevicesWithContext indicates an expected call of ListVirtualMFADevicesWithContext. +func (mr *MockIAMAPIMockRecorder) ListVirtualMFADevicesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVirtualMFADevicesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ListVirtualMFADevicesWithContext), varargs...) +} + +// PutGroupPolicy mocks base method. +func (m *MockIAMAPI) PutGroupPolicy(arg0 *iam.PutGroupPolicyInput) (*iam.PutGroupPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutGroupPolicy", arg0) + ret0, _ := ret[0].(*iam.PutGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutGroupPolicy indicates an expected call of PutGroupPolicy. +func (mr *MockIAMAPIMockRecorder) PutGroupPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutGroupPolicy", reflect.TypeOf((*MockIAMAPI)(nil).PutGroupPolicy), arg0) +} + +// PutGroupPolicyRequest mocks base method. +func (m *MockIAMAPI) PutGroupPolicyRequest(arg0 *iam.PutGroupPolicyInput) (*request.Request, *iam.PutGroupPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutGroupPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.PutGroupPolicyOutput) + return ret0, ret1 +} + +// PutGroupPolicyRequest indicates an expected call of PutGroupPolicyRequest. +func (mr *MockIAMAPIMockRecorder) PutGroupPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutGroupPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).PutGroupPolicyRequest), arg0) +} + +// PutGroupPolicyWithContext mocks base method. +func (m *MockIAMAPI) PutGroupPolicyWithContext(arg0 aws.Context, arg1 *iam.PutGroupPolicyInput, arg2 ...request.Option) (*iam.PutGroupPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PutGroupPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.PutGroupPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutGroupPolicyWithContext indicates an expected call of PutGroupPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) PutGroupPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutGroupPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).PutGroupPolicyWithContext), varargs...) +} + +// PutRolePermissionsBoundary mocks base method. +func (m *MockIAMAPI) PutRolePermissionsBoundary(arg0 *iam.PutRolePermissionsBoundaryInput) (*iam.PutRolePermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutRolePermissionsBoundary", arg0) + ret0, _ := ret[0].(*iam.PutRolePermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutRolePermissionsBoundary indicates an expected call of PutRolePermissionsBoundary. +func (mr *MockIAMAPIMockRecorder) PutRolePermissionsBoundary(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutRolePermissionsBoundary", reflect.TypeOf((*MockIAMAPI)(nil).PutRolePermissionsBoundary), arg0) +} + +// PutRolePermissionsBoundaryRequest mocks base method. +func (m *MockIAMAPI) PutRolePermissionsBoundaryRequest(arg0 *iam.PutRolePermissionsBoundaryInput) (*request.Request, *iam.PutRolePermissionsBoundaryOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutRolePermissionsBoundaryRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.PutRolePermissionsBoundaryOutput) + return ret0, ret1 +} + +// PutRolePermissionsBoundaryRequest indicates an expected call of PutRolePermissionsBoundaryRequest. +func (mr *MockIAMAPIMockRecorder) PutRolePermissionsBoundaryRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutRolePermissionsBoundaryRequest", reflect.TypeOf((*MockIAMAPI)(nil).PutRolePermissionsBoundaryRequest), arg0) +} + +// PutRolePermissionsBoundaryWithContext mocks base method. +func (m *MockIAMAPI) PutRolePermissionsBoundaryWithContext(arg0 aws.Context, arg1 *iam.PutRolePermissionsBoundaryInput, arg2 ...request.Option) (*iam.PutRolePermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PutRolePermissionsBoundaryWithContext", varargs...) + ret0, _ := ret[0].(*iam.PutRolePermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutRolePermissionsBoundaryWithContext indicates an expected call of PutRolePermissionsBoundaryWithContext. +func (mr *MockIAMAPIMockRecorder) PutRolePermissionsBoundaryWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutRolePermissionsBoundaryWithContext", reflect.TypeOf((*MockIAMAPI)(nil).PutRolePermissionsBoundaryWithContext), varargs...) +} + +// PutRolePolicy mocks base method. +func (m *MockIAMAPI) PutRolePolicy(arg0 *iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutRolePolicy", arg0) + ret0, _ := ret[0].(*iam.PutRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutRolePolicy indicates an expected call of PutRolePolicy. +func (mr *MockIAMAPIMockRecorder) PutRolePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutRolePolicy", reflect.TypeOf((*MockIAMAPI)(nil).PutRolePolicy), arg0) +} + +// PutRolePolicyRequest mocks base method. +func (m *MockIAMAPI) PutRolePolicyRequest(arg0 *iam.PutRolePolicyInput) (*request.Request, *iam.PutRolePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutRolePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.PutRolePolicyOutput) + return ret0, ret1 +} + +// PutRolePolicyRequest indicates an expected call of PutRolePolicyRequest. +func (mr *MockIAMAPIMockRecorder) PutRolePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutRolePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).PutRolePolicyRequest), arg0) +} + +// PutRolePolicyWithContext mocks base method. +func (m *MockIAMAPI) PutRolePolicyWithContext(arg0 aws.Context, arg1 *iam.PutRolePolicyInput, arg2 ...request.Option) (*iam.PutRolePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PutRolePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.PutRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutRolePolicyWithContext indicates an expected call of PutRolePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) PutRolePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutRolePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).PutRolePolicyWithContext), varargs...) +} + +// PutUserPermissionsBoundary mocks base method. +func (m *MockIAMAPI) PutUserPermissionsBoundary(arg0 *iam.PutUserPermissionsBoundaryInput) (*iam.PutUserPermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutUserPermissionsBoundary", arg0) + ret0, _ := ret[0].(*iam.PutUserPermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutUserPermissionsBoundary indicates an expected call of PutUserPermissionsBoundary. +func (mr *MockIAMAPIMockRecorder) PutUserPermissionsBoundary(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUserPermissionsBoundary", reflect.TypeOf((*MockIAMAPI)(nil).PutUserPermissionsBoundary), arg0) +} + +// PutUserPermissionsBoundaryRequest mocks base method. +func (m *MockIAMAPI) PutUserPermissionsBoundaryRequest(arg0 *iam.PutUserPermissionsBoundaryInput) (*request.Request, *iam.PutUserPermissionsBoundaryOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutUserPermissionsBoundaryRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.PutUserPermissionsBoundaryOutput) + return ret0, ret1 +} + +// PutUserPermissionsBoundaryRequest indicates an expected call of PutUserPermissionsBoundaryRequest. +func (mr *MockIAMAPIMockRecorder) PutUserPermissionsBoundaryRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUserPermissionsBoundaryRequest", reflect.TypeOf((*MockIAMAPI)(nil).PutUserPermissionsBoundaryRequest), arg0) +} + +// PutUserPermissionsBoundaryWithContext mocks base method. +func (m *MockIAMAPI) PutUserPermissionsBoundaryWithContext(arg0 aws.Context, arg1 *iam.PutUserPermissionsBoundaryInput, arg2 ...request.Option) (*iam.PutUserPermissionsBoundaryOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PutUserPermissionsBoundaryWithContext", varargs...) + ret0, _ := ret[0].(*iam.PutUserPermissionsBoundaryOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutUserPermissionsBoundaryWithContext indicates an expected call of PutUserPermissionsBoundaryWithContext. +func (mr *MockIAMAPIMockRecorder) PutUserPermissionsBoundaryWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUserPermissionsBoundaryWithContext", reflect.TypeOf((*MockIAMAPI)(nil).PutUserPermissionsBoundaryWithContext), varargs...) +} + +// PutUserPolicy mocks base method. +func (m *MockIAMAPI) PutUserPolicy(arg0 *iam.PutUserPolicyInput) (*iam.PutUserPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutUserPolicy", arg0) + ret0, _ := ret[0].(*iam.PutUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutUserPolicy indicates an expected call of PutUserPolicy. +func (mr *MockIAMAPIMockRecorder) PutUserPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUserPolicy", reflect.TypeOf((*MockIAMAPI)(nil).PutUserPolicy), arg0) +} + +// PutUserPolicyRequest mocks base method. +func (m *MockIAMAPI) PutUserPolicyRequest(arg0 *iam.PutUserPolicyInput) (*request.Request, *iam.PutUserPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutUserPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.PutUserPolicyOutput) + return ret0, ret1 +} + +// PutUserPolicyRequest indicates an expected call of PutUserPolicyRequest. +func (mr *MockIAMAPIMockRecorder) PutUserPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUserPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).PutUserPolicyRequest), arg0) +} + +// PutUserPolicyWithContext mocks base method. +func (m *MockIAMAPI) PutUserPolicyWithContext(arg0 aws.Context, arg1 *iam.PutUserPolicyInput, arg2 ...request.Option) (*iam.PutUserPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PutUserPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.PutUserPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutUserPolicyWithContext indicates an expected call of PutUserPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) PutUserPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUserPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).PutUserPolicyWithContext), varargs...) +} + +// RemoveClientIDFromOpenIDConnectProvider mocks base method. +func (m *MockIAMAPI) RemoveClientIDFromOpenIDConnectProvider(arg0 *iam.RemoveClientIDFromOpenIDConnectProviderInput) (*iam.RemoveClientIDFromOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveClientIDFromOpenIDConnectProvider", arg0) + ret0, _ := ret[0].(*iam.RemoveClientIDFromOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveClientIDFromOpenIDConnectProvider indicates an expected call of RemoveClientIDFromOpenIDConnectProvider. +func (mr *MockIAMAPIMockRecorder) RemoveClientIDFromOpenIDConnectProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveClientIDFromOpenIDConnectProvider", reflect.TypeOf((*MockIAMAPI)(nil).RemoveClientIDFromOpenIDConnectProvider), arg0) +} + +// RemoveClientIDFromOpenIDConnectProviderRequest mocks base method. +func (m *MockIAMAPI) RemoveClientIDFromOpenIDConnectProviderRequest(arg0 *iam.RemoveClientIDFromOpenIDConnectProviderInput) (*request.Request, *iam.RemoveClientIDFromOpenIDConnectProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveClientIDFromOpenIDConnectProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.RemoveClientIDFromOpenIDConnectProviderOutput) + return ret0, ret1 +} + +// RemoveClientIDFromOpenIDConnectProviderRequest indicates an expected call of RemoveClientIDFromOpenIDConnectProviderRequest. +func (mr *MockIAMAPIMockRecorder) RemoveClientIDFromOpenIDConnectProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveClientIDFromOpenIDConnectProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).RemoveClientIDFromOpenIDConnectProviderRequest), arg0) +} + +// RemoveClientIDFromOpenIDConnectProviderWithContext mocks base method. +func (m *MockIAMAPI) RemoveClientIDFromOpenIDConnectProviderWithContext(arg0 aws.Context, arg1 *iam.RemoveClientIDFromOpenIDConnectProviderInput, arg2 ...request.Option) (*iam.RemoveClientIDFromOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RemoveClientIDFromOpenIDConnectProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.RemoveClientIDFromOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveClientIDFromOpenIDConnectProviderWithContext indicates an expected call of RemoveClientIDFromOpenIDConnectProviderWithContext. +func (mr *MockIAMAPIMockRecorder) RemoveClientIDFromOpenIDConnectProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveClientIDFromOpenIDConnectProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).RemoveClientIDFromOpenIDConnectProviderWithContext), varargs...) +} + +// RemoveRoleFromInstanceProfile mocks base method. +func (m *MockIAMAPI) RemoveRoleFromInstanceProfile(arg0 *iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveRoleFromInstanceProfile", arg0) + ret0, _ := ret[0].(*iam.RemoveRoleFromInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveRoleFromInstanceProfile indicates an expected call of RemoveRoleFromInstanceProfile. +func (mr *MockIAMAPIMockRecorder) RemoveRoleFromInstanceProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRoleFromInstanceProfile", reflect.TypeOf((*MockIAMAPI)(nil).RemoveRoleFromInstanceProfile), arg0) +} + +// RemoveRoleFromInstanceProfileRequest mocks base method. +func (m *MockIAMAPI) RemoveRoleFromInstanceProfileRequest(arg0 *iam.RemoveRoleFromInstanceProfileInput) (*request.Request, *iam.RemoveRoleFromInstanceProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveRoleFromInstanceProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.RemoveRoleFromInstanceProfileOutput) + return ret0, ret1 +} + +// RemoveRoleFromInstanceProfileRequest indicates an expected call of RemoveRoleFromInstanceProfileRequest. +func (mr *MockIAMAPIMockRecorder) RemoveRoleFromInstanceProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRoleFromInstanceProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).RemoveRoleFromInstanceProfileRequest), arg0) +} + +// RemoveRoleFromInstanceProfileWithContext mocks base method. +func (m *MockIAMAPI) RemoveRoleFromInstanceProfileWithContext(arg0 aws.Context, arg1 *iam.RemoveRoleFromInstanceProfileInput, arg2 ...request.Option) (*iam.RemoveRoleFromInstanceProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RemoveRoleFromInstanceProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.RemoveRoleFromInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveRoleFromInstanceProfileWithContext indicates an expected call of RemoveRoleFromInstanceProfileWithContext. +func (mr *MockIAMAPIMockRecorder) RemoveRoleFromInstanceProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRoleFromInstanceProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).RemoveRoleFromInstanceProfileWithContext), varargs...) +} + +// RemoveUserFromGroup mocks base method. +func (m *MockIAMAPI) RemoveUserFromGroup(arg0 *iam.RemoveUserFromGroupInput) (*iam.RemoveUserFromGroupOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveUserFromGroup", arg0) + ret0, _ := ret[0].(*iam.RemoveUserFromGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveUserFromGroup indicates an expected call of RemoveUserFromGroup. +func (mr *MockIAMAPIMockRecorder) RemoveUserFromGroup(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveUserFromGroup", reflect.TypeOf((*MockIAMAPI)(nil).RemoveUserFromGroup), arg0) +} + +// RemoveUserFromGroupRequest mocks base method. +func (m *MockIAMAPI) RemoveUserFromGroupRequest(arg0 *iam.RemoveUserFromGroupInput) (*request.Request, *iam.RemoveUserFromGroupOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemoveUserFromGroupRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.RemoveUserFromGroupOutput) + return ret0, ret1 +} + +// RemoveUserFromGroupRequest indicates an expected call of RemoveUserFromGroupRequest. +func (mr *MockIAMAPIMockRecorder) RemoveUserFromGroupRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveUserFromGroupRequest", reflect.TypeOf((*MockIAMAPI)(nil).RemoveUserFromGroupRequest), arg0) +} + +// RemoveUserFromGroupWithContext mocks base method. +func (m *MockIAMAPI) RemoveUserFromGroupWithContext(arg0 aws.Context, arg1 *iam.RemoveUserFromGroupInput, arg2 ...request.Option) (*iam.RemoveUserFromGroupOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RemoveUserFromGroupWithContext", varargs...) + ret0, _ := ret[0].(*iam.RemoveUserFromGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemoveUserFromGroupWithContext indicates an expected call of RemoveUserFromGroupWithContext. +func (mr *MockIAMAPIMockRecorder) RemoveUserFromGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveUserFromGroupWithContext", reflect.TypeOf((*MockIAMAPI)(nil).RemoveUserFromGroupWithContext), varargs...) +} + +// ResetServiceSpecificCredential mocks base method. +func (m *MockIAMAPI) ResetServiceSpecificCredential(arg0 *iam.ResetServiceSpecificCredentialInput) (*iam.ResetServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResetServiceSpecificCredential", arg0) + ret0, _ := ret[0].(*iam.ResetServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResetServiceSpecificCredential indicates an expected call of ResetServiceSpecificCredential. +func (mr *MockIAMAPIMockRecorder) ResetServiceSpecificCredential(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetServiceSpecificCredential", reflect.TypeOf((*MockIAMAPI)(nil).ResetServiceSpecificCredential), arg0) +} + +// ResetServiceSpecificCredentialRequest mocks base method. +func (m *MockIAMAPI) ResetServiceSpecificCredentialRequest(arg0 *iam.ResetServiceSpecificCredentialInput) (*request.Request, *iam.ResetServiceSpecificCredentialOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResetServiceSpecificCredentialRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ResetServiceSpecificCredentialOutput) + return ret0, ret1 +} + +// ResetServiceSpecificCredentialRequest indicates an expected call of ResetServiceSpecificCredentialRequest. +func (mr *MockIAMAPIMockRecorder) ResetServiceSpecificCredentialRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetServiceSpecificCredentialRequest", reflect.TypeOf((*MockIAMAPI)(nil).ResetServiceSpecificCredentialRequest), arg0) +} + +// ResetServiceSpecificCredentialWithContext mocks base method. +func (m *MockIAMAPI) ResetServiceSpecificCredentialWithContext(arg0 aws.Context, arg1 *iam.ResetServiceSpecificCredentialInput, arg2 ...request.Option) (*iam.ResetServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ResetServiceSpecificCredentialWithContext", varargs...) + ret0, _ := ret[0].(*iam.ResetServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResetServiceSpecificCredentialWithContext indicates an expected call of ResetServiceSpecificCredentialWithContext. +func (mr *MockIAMAPIMockRecorder) ResetServiceSpecificCredentialWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetServiceSpecificCredentialWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ResetServiceSpecificCredentialWithContext), varargs...) +} + +// ResyncMFADevice mocks base method. +func (m *MockIAMAPI) ResyncMFADevice(arg0 *iam.ResyncMFADeviceInput) (*iam.ResyncMFADeviceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResyncMFADevice", arg0) + ret0, _ := ret[0].(*iam.ResyncMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResyncMFADevice indicates an expected call of ResyncMFADevice. +func (mr *MockIAMAPIMockRecorder) ResyncMFADevice(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResyncMFADevice", reflect.TypeOf((*MockIAMAPI)(nil).ResyncMFADevice), arg0) +} + +// ResyncMFADeviceRequest mocks base method. +func (m *MockIAMAPI) ResyncMFADeviceRequest(arg0 *iam.ResyncMFADeviceInput) (*request.Request, *iam.ResyncMFADeviceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResyncMFADeviceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.ResyncMFADeviceOutput) + return ret0, ret1 +} + +// ResyncMFADeviceRequest indicates an expected call of ResyncMFADeviceRequest. +func (mr *MockIAMAPIMockRecorder) ResyncMFADeviceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResyncMFADeviceRequest", reflect.TypeOf((*MockIAMAPI)(nil).ResyncMFADeviceRequest), arg0) +} + +// ResyncMFADeviceWithContext mocks base method. +func (m *MockIAMAPI) ResyncMFADeviceWithContext(arg0 aws.Context, arg1 *iam.ResyncMFADeviceInput, arg2 ...request.Option) (*iam.ResyncMFADeviceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ResyncMFADeviceWithContext", varargs...) + ret0, _ := ret[0].(*iam.ResyncMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResyncMFADeviceWithContext indicates an expected call of ResyncMFADeviceWithContext. +func (mr *MockIAMAPIMockRecorder) ResyncMFADeviceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResyncMFADeviceWithContext", reflect.TypeOf((*MockIAMAPI)(nil).ResyncMFADeviceWithContext), varargs...) +} + +// SetDefaultPolicyVersion mocks base method. +func (m *MockIAMAPI) SetDefaultPolicyVersion(arg0 *iam.SetDefaultPolicyVersionInput) (*iam.SetDefaultPolicyVersionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetDefaultPolicyVersion", arg0) + ret0, _ := ret[0].(*iam.SetDefaultPolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetDefaultPolicyVersion indicates an expected call of SetDefaultPolicyVersion. +func (mr *MockIAMAPIMockRecorder) SetDefaultPolicyVersion(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDefaultPolicyVersion", reflect.TypeOf((*MockIAMAPI)(nil).SetDefaultPolicyVersion), arg0) +} + +// SetDefaultPolicyVersionRequest mocks base method. +func (m *MockIAMAPI) SetDefaultPolicyVersionRequest(arg0 *iam.SetDefaultPolicyVersionInput) (*request.Request, *iam.SetDefaultPolicyVersionOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetDefaultPolicyVersionRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.SetDefaultPolicyVersionOutput) + return ret0, ret1 +} + +// SetDefaultPolicyVersionRequest indicates an expected call of SetDefaultPolicyVersionRequest. +func (mr *MockIAMAPIMockRecorder) SetDefaultPolicyVersionRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDefaultPolicyVersionRequest", reflect.TypeOf((*MockIAMAPI)(nil).SetDefaultPolicyVersionRequest), arg0) +} + +// SetDefaultPolicyVersionWithContext mocks base method. +func (m *MockIAMAPI) SetDefaultPolicyVersionWithContext(arg0 aws.Context, arg1 *iam.SetDefaultPolicyVersionInput, arg2 ...request.Option) (*iam.SetDefaultPolicyVersionOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SetDefaultPolicyVersionWithContext", varargs...) + ret0, _ := ret[0].(*iam.SetDefaultPolicyVersionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetDefaultPolicyVersionWithContext indicates an expected call of SetDefaultPolicyVersionWithContext. +func (mr *MockIAMAPIMockRecorder) SetDefaultPolicyVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDefaultPolicyVersionWithContext", reflect.TypeOf((*MockIAMAPI)(nil).SetDefaultPolicyVersionWithContext), varargs...) +} + +// SetSecurityTokenServicePreferences mocks base method. +func (m *MockIAMAPI) SetSecurityTokenServicePreferences(arg0 *iam.SetSecurityTokenServicePreferencesInput) (*iam.SetSecurityTokenServicePreferencesOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetSecurityTokenServicePreferences", arg0) + ret0, _ := ret[0].(*iam.SetSecurityTokenServicePreferencesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetSecurityTokenServicePreferences indicates an expected call of SetSecurityTokenServicePreferences. +func (mr *MockIAMAPIMockRecorder) SetSecurityTokenServicePreferences(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSecurityTokenServicePreferences", reflect.TypeOf((*MockIAMAPI)(nil).SetSecurityTokenServicePreferences), arg0) +} + +// SetSecurityTokenServicePreferencesRequest mocks base method. +func (m *MockIAMAPI) SetSecurityTokenServicePreferencesRequest(arg0 *iam.SetSecurityTokenServicePreferencesInput) (*request.Request, *iam.SetSecurityTokenServicePreferencesOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetSecurityTokenServicePreferencesRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.SetSecurityTokenServicePreferencesOutput) + return ret0, ret1 +} + +// SetSecurityTokenServicePreferencesRequest indicates an expected call of SetSecurityTokenServicePreferencesRequest. +func (mr *MockIAMAPIMockRecorder) SetSecurityTokenServicePreferencesRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSecurityTokenServicePreferencesRequest", reflect.TypeOf((*MockIAMAPI)(nil).SetSecurityTokenServicePreferencesRequest), arg0) +} + +// SetSecurityTokenServicePreferencesWithContext mocks base method. +func (m *MockIAMAPI) SetSecurityTokenServicePreferencesWithContext(arg0 aws.Context, arg1 *iam.SetSecurityTokenServicePreferencesInput, arg2 ...request.Option) (*iam.SetSecurityTokenServicePreferencesOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SetSecurityTokenServicePreferencesWithContext", varargs...) + ret0, _ := ret[0].(*iam.SetSecurityTokenServicePreferencesOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetSecurityTokenServicePreferencesWithContext indicates an expected call of SetSecurityTokenServicePreferencesWithContext. +func (mr *MockIAMAPIMockRecorder) SetSecurityTokenServicePreferencesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSecurityTokenServicePreferencesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).SetSecurityTokenServicePreferencesWithContext), varargs...) +} + +// SimulateCustomPolicy mocks base method. +func (m *MockIAMAPI) SimulateCustomPolicy(arg0 *iam.SimulateCustomPolicyInput) (*iam.SimulatePolicyResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SimulateCustomPolicy", arg0) + ret0, _ := ret[0].(*iam.SimulatePolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SimulateCustomPolicy indicates an expected call of SimulateCustomPolicy. +func (mr *MockIAMAPIMockRecorder) SimulateCustomPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulateCustomPolicy", reflect.TypeOf((*MockIAMAPI)(nil).SimulateCustomPolicy), arg0) +} + +// SimulateCustomPolicyPages mocks base method. +func (m *MockIAMAPI) SimulateCustomPolicyPages(arg0 *iam.SimulateCustomPolicyInput, arg1 func(*iam.SimulatePolicyResponse, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SimulateCustomPolicyPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SimulateCustomPolicyPages indicates an expected call of SimulateCustomPolicyPages. +func (mr *MockIAMAPIMockRecorder) SimulateCustomPolicyPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulateCustomPolicyPages", reflect.TypeOf((*MockIAMAPI)(nil).SimulateCustomPolicyPages), arg0, arg1) +} + +// SimulateCustomPolicyPagesWithContext mocks base method. +func (m *MockIAMAPI) SimulateCustomPolicyPagesWithContext(arg0 aws.Context, arg1 *iam.SimulateCustomPolicyInput, arg2 func(*iam.SimulatePolicyResponse, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SimulateCustomPolicyPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// SimulateCustomPolicyPagesWithContext indicates an expected call of SimulateCustomPolicyPagesWithContext. +func (mr *MockIAMAPIMockRecorder) SimulateCustomPolicyPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulateCustomPolicyPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).SimulateCustomPolicyPagesWithContext), varargs...) +} + +// SimulateCustomPolicyRequest mocks base method. +func (m *MockIAMAPI) SimulateCustomPolicyRequest(arg0 *iam.SimulateCustomPolicyInput) (*request.Request, *iam.SimulatePolicyResponse) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SimulateCustomPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.SimulatePolicyResponse) + return ret0, ret1 +} + +// SimulateCustomPolicyRequest indicates an expected call of SimulateCustomPolicyRequest. +func (mr *MockIAMAPIMockRecorder) SimulateCustomPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulateCustomPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).SimulateCustomPolicyRequest), arg0) +} + +// SimulateCustomPolicyWithContext mocks base method. +func (m *MockIAMAPI) SimulateCustomPolicyWithContext(arg0 aws.Context, arg1 *iam.SimulateCustomPolicyInput, arg2 ...request.Option) (*iam.SimulatePolicyResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SimulateCustomPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.SimulatePolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SimulateCustomPolicyWithContext indicates an expected call of SimulateCustomPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) SimulateCustomPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulateCustomPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).SimulateCustomPolicyWithContext), varargs...) +} + +// SimulatePrincipalPolicy mocks base method. +func (m *MockIAMAPI) SimulatePrincipalPolicy(arg0 *iam.SimulatePrincipalPolicyInput) (*iam.SimulatePolicyResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SimulatePrincipalPolicy", arg0) + ret0, _ := ret[0].(*iam.SimulatePolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SimulatePrincipalPolicy indicates an expected call of SimulatePrincipalPolicy. +func (mr *MockIAMAPIMockRecorder) SimulatePrincipalPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulatePrincipalPolicy", reflect.TypeOf((*MockIAMAPI)(nil).SimulatePrincipalPolicy), arg0) +} + +// SimulatePrincipalPolicyPages mocks base method. +func (m *MockIAMAPI) SimulatePrincipalPolicyPages(arg0 *iam.SimulatePrincipalPolicyInput, arg1 func(*iam.SimulatePolicyResponse, bool) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SimulatePrincipalPolicyPages", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SimulatePrincipalPolicyPages indicates an expected call of SimulatePrincipalPolicyPages. +func (mr *MockIAMAPIMockRecorder) SimulatePrincipalPolicyPages(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulatePrincipalPolicyPages", reflect.TypeOf((*MockIAMAPI)(nil).SimulatePrincipalPolicyPages), arg0, arg1) +} + +// SimulatePrincipalPolicyPagesWithContext mocks base method. +func (m *MockIAMAPI) SimulatePrincipalPolicyPagesWithContext(arg0 aws.Context, arg1 *iam.SimulatePrincipalPolicyInput, arg2 func(*iam.SimulatePolicyResponse, bool) bool, arg3 ...request.Option) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1, arg2} + for _, a := range arg3 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SimulatePrincipalPolicyPagesWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// SimulatePrincipalPolicyPagesWithContext indicates an expected call of SimulatePrincipalPolicyPagesWithContext. +func (mr *MockIAMAPIMockRecorder) SimulatePrincipalPolicyPagesWithContext(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1, arg2}, arg3...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulatePrincipalPolicyPagesWithContext", reflect.TypeOf((*MockIAMAPI)(nil).SimulatePrincipalPolicyPagesWithContext), varargs...) +} + +// SimulatePrincipalPolicyRequest mocks base method. +func (m *MockIAMAPI) SimulatePrincipalPolicyRequest(arg0 *iam.SimulatePrincipalPolicyInput) (*request.Request, *iam.SimulatePolicyResponse) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SimulatePrincipalPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.SimulatePolicyResponse) + return ret0, ret1 +} + +// SimulatePrincipalPolicyRequest indicates an expected call of SimulatePrincipalPolicyRequest. +func (mr *MockIAMAPIMockRecorder) SimulatePrincipalPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulatePrincipalPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).SimulatePrincipalPolicyRequest), arg0) +} + +// SimulatePrincipalPolicyWithContext mocks base method. +func (m *MockIAMAPI) SimulatePrincipalPolicyWithContext(arg0 aws.Context, arg1 *iam.SimulatePrincipalPolicyInput, arg2 ...request.Option) (*iam.SimulatePolicyResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SimulatePrincipalPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.SimulatePolicyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SimulatePrincipalPolicyWithContext indicates an expected call of SimulatePrincipalPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) SimulatePrincipalPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SimulatePrincipalPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).SimulatePrincipalPolicyWithContext), varargs...) +} + +// TagInstanceProfile mocks base method. +func (m *MockIAMAPI) TagInstanceProfile(arg0 *iam.TagInstanceProfileInput) (*iam.TagInstanceProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagInstanceProfile", arg0) + ret0, _ := ret[0].(*iam.TagInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagInstanceProfile indicates an expected call of TagInstanceProfile. +func (mr *MockIAMAPIMockRecorder) TagInstanceProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagInstanceProfile", reflect.TypeOf((*MockIAMAPI)(nil).TagInstanceProfile), arg0) +} + +// TagInstanceProfileRequest mocks base method. +func (m *MockIAMAPI) TagInstanceProfileRequest(arg0 *iam.TagInstanceProfileInput) (*request.Request, *iam.TagInstanceProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagInstanceProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagInstanceProfileOutput) + return ret0, ret1 +} + +// TagInstanceProfileRequest indicates an expected call of TagInstanceProfileRequest. +func (mr *MockIAMAPIMockRecorder) TagInstanceProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagInstanceProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagInstanceProfileRequest), arg0) +} + +// TagInstanceProfileWithContext mocks base method. +func (m *MockIAMAPI) TagInstanceProfileWithContext(arg0 aws.Context, arg1 *iam.TagInstanceProfileInput, arg2 ...request.Option) (*iam.TagInstanceProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagInstanceProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagInstanceProfileWithContext indicates an expected call of TagInstanceProfileWithContext. +func (mr *MockIAMAPIMockRecorder) TagInstanceProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagInstanceProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagInstanceProfileWithContext), varargs...) +} + +// TagMFADevice mocks base method. +func (m *MockIAMAPI) TagMFADevice(arg0 *iam.TagMFADeviceInput) (*iam.TagMFADeviceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagMFADevice", arg0) + ret0, _ := ret[0].(*iam.TagMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagMFADevice indicates an expected call of TagMFADevice. +func (mr *MockIAMAPIMockRecorder) TagMFADevice(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagMFADevice", reflect.TypeOf((*MockIAMAPI)(nil).TagMFADevice), arg0) +} + +// TagMFADeviceRequest mocks base method. +func (m *MockIAMAPI) TagMFADeviceRequest(arg0 *iam.TagMFADeviceInput) (*request.Request, *iam.TagMFADeviceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagMFADeviceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagMFADeviceOutput) + return ret0, ret1 +} + +// TagMFADeviceRequest indicates an expected call of TagMFADeviceRequest. +func (mr *MockIAMAPIMockRecorder) TagMFADeviceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagMFADeviceRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagMFADeviceRequest), arg0) +} + +// TagMFADeviceWithContext mocks base method. +func (m *MockIAMAPI) TagMFADeviceWithContext(arg0 aws.Context, arg1 *iam.TagMFADeviceInput, arg2 ...request.Option) (*iam.TagMFADeviceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagMFADeviceWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagMFADeviceWithContext indicates an expected call of TagMFADeviceWithContext. +func (mr *MockIAMAPIMockRecorder) TagMFADeviceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagMFADeviceWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagMFADeviceWithContext), varargs...) +} + +// TagOpenIDConnectProvider mocks base method. +func (m *MockIAMAPI) TagOpenIDConnectProvider(arg0 *iam.TagOpenIDConnectProviderInput) (*iam.TagOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagOpenIDConnectProvider", arg0) + ret0, _ := ret[0].(*iam.TagOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagOpenIDConnectProvider indicates an expected call of TagOpenIDConnectProvider. +func (mr *MockIAMAPIMockRecorder) TagOpenIDConnectProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagOpenIDConnectProvider", reflect.TypeOf((*MockIAMAPI)(nil).TagOpenIDConnectProvider), arg0) +} + +// TagOpenIDConnectProviderRequest mocks base method. +func (m *MockIAMAPI) TagOpenIDConnectProviderRequest(arg0 *iam.TagOpenIDConnectProviderInput) (*request.Request, *iam.TagOpenIDConnectProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagOpenIDConnectProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagOpenIDConnectProviderOutput) + return ret0, ret1 +} + +// TagOpenIDConnectProviderRequest indicates an expected call of TagOpenIDConnectProviderRequest. +func (mr *MockIAMAPIMockRecorder) TagOpenIDConnectProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagOpenIDConnectProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagOpenIDConnectProviderRequest), arg0) +} + +// TagOpenIDConnectProviderWithContext mocks base method. +func (m *MockIAMAPI) TagOpenIDConnectProviderWithContext(arg0 aws.Context, arg1 *iam.TagOpenIDConnectProviderInput, arg2 ...request.Option) (*iam.TagOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagOpenIDConnectProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagOpenIDConnectProviderWithContext indicates an expected call of TagOpenIDConnectProviderWithContext. +func (mr *MockIAMAPIMockRecorder) TagOpenIDConnectProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagOpenIDConnectProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagOpenIDConnectProviderWithContext), varargs...) +} + +// TagPolicy mocks base method. +func (m *MockIAMAPI) TagPolicy(arg0 *iam.TagPolicyInput) (*iam.TagPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagPolicy", arg0) + ret0, _ := ret[0].(*iam.TagPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagPolicy indicates an expected call of TagPolicy. +func (mr *MockIAMAPIMockRecorder) TagPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagPolicy", reflect.TypeOf((*MockIAMAPI)(nil).TagPolicy), arg0) +} + +// TagPolicyRequest mocks base method. +func (m *MockIAMAPI) TagPolicyRequest(arg0 *iam.TagPolicyInput) (*request.Request, *iam.TagPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagPolicyOutput) + return ret0, ret1 +} + +// TagPolicyRequest indicates an expected call of TagPolicyRequest. +func (mr *MockIAMAPIMockRecorder) TagPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagPolicyRequest), arg0) +} + +// TagPolicyWithContext mocks base method. +func (m *MockIAMAPI) TagPolicyWithContext(arg0 aws.Context, arg1 *iam.TagPolicyInput, arg2 ...request.Option) (*iam.TagPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagPolicyWithContext indicates an expected call of TagPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) TagPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagPolicyWithContext), varargs...) +} + +// TagRole mocks base method. +func (m *MockIAMAPI) TagRole(arg0 *iam.TagRoleInput) (*iam.TagRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagRole", arg0) + ret0, _ := ret[0].(*iam.TagRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagRole indicates an expected call of TagRole. +func (mr *MockIAMAPIMockRecorder) TagRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagRole", reflect.TypeOf((*MockIAMAPI)(nil).TagRole), arg0) +} + +// TagRoleRequest mocks base method. +func (m *MockIAMAPI) TagRoleRequest(arg0 *iam.TagRoleInput) (*request.Request, *iam.TagRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagRoleOutput) + return ret0, ret1 +} + +// TagRoleRequest indicates an expected call of TagRoleRequest. +func (mr *MockIAMAPIMockRecorder) TagRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagRoleRequest), arg0) +} + +// TagRoleWithContext mocks base method. +func (m *MockIAMAPI) TagRoleWithContext(arg0 aws.Context, arg1 *iam.TagRoleInput, arg2 ...request.Option) (*iam.TagRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagRoleWithContext indicates an expected call of TagRoleWithContext. +func (mr *MockIAMAPIMockRecorder) TagRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagRoleWithContext), varargs...) +} + +// TagSAMLProvider mocks base method. +func (m *MockIAMAPI) TagSAMLProvider(arg0 *iam.TagSAMLProviderInput) (*iam.TagSAMLProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagSAMLProvider", arg0) + ret0, _ := ret[0].(*iam.TagSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagSAMLProvider indicates an expected call of TagSAMLProvider. +func (mr *MockIAMAPIMockRecorder) TagSAMLProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagSAMLProvider", reflect.TypeOf((*MockIAMAPI)(nil).TagSAMLProvider), arg0) +} + +// TagSAMLProviderRequest mocks base method. +func (m *MockIAMAPI) TagSAMLProviderRequest(arg0 *iam.TagSAMLProviderInput) (*request.Request, *iam.TagSAMLProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagSAMLProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagSAMLProviderOutput) + return ret0, ret1 +} + +// TagSAMLProviderRequest indicates an expected call of TagSAMLProviderRequest. +func (mr *MockIAMAPIMockRecorder) TagSAMLProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagSAMLProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagSAMLProviderRequest), arg0) +} + +// TagSAMLProviderWithContext mocks base method. +func (m *MockIAMAPI) TagSAMLProviderWithContext(arg0 aws.Context, arg1 *iam.TagSAMLProviderInput, arg2 ...request.Option) (*iam.TagSAMLProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagSAMLProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagSAMLProviderWithContext indicates an expected call of TagSAMLProviderWithContext. +func (mr *MockIAMAPIMockRecorder) TagSAMLProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagSAMLProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagSAMLProviderWithContext), varargs...) +} + +// TagServerCertificate mocks base method. +func (m *MockIAMAPI) TagServerCertificate(arg0 *iam.TagServerCertificateInput) (*iam.TagServerCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagServerCertificate", arg0) + ret0, _ := ret[0].(*iam.TagServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagServerCertificate indicates an expected call of TagServerCertificate. +func (mr *MockIAMAPIMockRecorder) TagServerCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagServerCertificate", reflect.TypeOf((*MockIAMAPI)(nil).TagServerCertificate), arg0) +} + +// TagServerCertificateRequest mocks base method. +func (m *MockIAMAPI) TagServerCertificateRequest(arg0 *iam.TagServerCertificateInput) (*request.Request, *iam.TagServerCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagServerCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagServerCertificateOutput) + return ret0, ret1 +} + +// TagServerCertificateRequest indicates an expected call of TagServerCertificateRequest. +func (mr *MockIAMAPIMockRecorder) TagServerCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagServerCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagServerCertificateRequest), arg0) +} + +// TagServerCertificateWithContext mocks base method. +func (m *MockIAMAPI) TagServerCertificateWithContext(arg0 aws.Context, arg1 *iam.TagServerCertificateInput, arg2 ...request.Option) (*iam.TagServerCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagServerCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagServerCertificateWithContext indicates an expected call of TagServerCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) TagServerCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagServerCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagServerCertificateWithContext), varargs...) +} + +// TagUser mocks base method. +func (m *MockIAMAPI) TagUser(arg0 *iam.TagUserInput) (*iam.TagUserOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagUser", arg0) + ret0, _ := ret[0].(*iam.TagUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagUser indicates an expected call of TagUser. +func (mr *MockIAMAPIMockRecorder) TagUser(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagUser", reflect.TypeOf((*MockIAMAPI)(nil).TagUser), arg0) +} + +// TagUserRequest mocks base method. +func (m *MockIAMAPI) TagUserRequest(arg0 *iam.TagUserInput) (*request.Request, *iam.TagUserOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TagUserRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.TagUserOutput) + return ret0, ret1 +} + +// TagUserRequest indicates an expected call of TagUserRequest. +func (mr *MockIAMAPIMockRecorder) TagUserRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagUserRequest", reflect.TypeOf((*MockIAMAPI)(nil).TagUserRequest), arg0) +} + +// TagUserWithContext mocks base method. +func (m *MockIAMAPI) TagUserWithContext(arg0 aws.Context, arg1 *iam.TagUserInput, arg2 ...request.Option) (*iam.TagUserOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "TagUserWithContext", varargs...) + ret0, _ := ret[0].(*iam.TagUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TagUserWithContext indicates an expected call of TagUserWithContext. +func (mr *MockIAMAPIMockRecorder) TagUserWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TagUserWithContext", reflect.TypeOf((*MockIAMAPI)(nil).TagUserWithContext), varargs...) +} + +// UntagInstanceProfile mocks base method. +func (m *MockIAMAPI) UntagInstanceProfile(arg0 *iam.UntagInstanceProfileInput) (*iam.UntagInstanceProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagInstanceProfile", arg0) + ret0, _ := ret[0].(*iam.UntagInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagInstanceProfile indicates an expected call of UntagInstanceProfile. +func (mr *MockIAMAPIMockRecorder) UntagInstanceProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagInstanceProfile", reflect.TypeOf((*MockIAMAPI)(nil).UntagInstanceProfile), arg0) +} + +// UntagInstanceProfileRequest mocks base method. +func (m *MockIAMAPI) UntagInstanceProfileRequest(arg0 *iam.UntagInstanceProfileInput) (*request.Request, *iam.UntagInstanceProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagInstanceProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagInstanceProfileOutput) + return ret0, ret1 +} + +// UntagInstanceProfileRequest indicates an expected call of UntagInstanceProfileRequest. +func (mr *MockIAMAPIMockRecorder) UntagInstanceProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagInstanceProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagInstanceProfileRequest), arg0) +} + +// UntagInstanceProfileWithContext mocks base method. +func (m *MockIAMAPI) UntagInstanceProfileWithContext(arg0 aws.Context, arg1 *iam.UntagInstanceProfileInput, arg2 ...request.Option) (*iam.UntagInstanceProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagInstanceProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagInstanceProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagInstanceProfileWithContext indicates an expected call of UntagInstanceProfileWithContext. +func (mr *MockIAMAPIMockRecorder) UntagInstanceProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagInstanceProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagInstanceProfileWithContext), varargs...) +} + +// UntagMFADevice mocks base method. +func (m *MockIAMAPI) UntagMFADevice(arg0 *iam.UntagMFADeviceInput) (*iam.UntagMFADeviceOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagMFADevice", arg0) + ret0, _ := ret[0].(*iam.UntagMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagMFADevice indicates an expected call of UntagMFADevice. +func (mr *MockIAMAPIMockRecorder) UntagMFADevice(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagMFADevice", reflect.TypeOf((*MockIAMAPI)(nil).UntagMFADevice), arg0) +} + +// UntagMFADeviceRequest mocks base method. +func (m *MockIAMAPI) UntagMFADeviceRequest(arg0 *iam.UntagMFADeviceInput) (*request.Request, *iam.UntagMFADeviceOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagMFADeviceRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagMFADeviceOutput) + return ret0, ret1 +} + +// UntagMFADeviceRequest indicates an expected call of UntagMFADeviceRequest. +func (mr *MockIAMAPIMockRecorder) UntagMFADeviceRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagMFADeviceRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagMFADeviceRequest), arg0) +} + +// UntagMFADeviceWithContext mocks base method. +func (m *MockIAMAPI) UntagMFADeviceWithContext(arg0 aws.Context, arg1 *iam.UntagMFADeviceInput, arg2 ...request.Option) (*iam.UntagMFADeviceOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagMFADeviceWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagMFADeviceOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagMFADeviceWithContext indicates an expected call of UntagMFADeviceWithContext. +func (mr *MockIAMAPIMockRecorder) UntagMFADeviceWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagMFADeviceWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagMFADeviceWithContext), varargs...) +} + +// UntagOpenIDConnectProvider mocks base method. +func (m *MockIAMAPI) UntagOpenIDConnectProvider(arg0 *iam.UntagOpenIDConnectProviderInput) (*iam.UntagOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagOpenIDConnectProvider", arg0) + ret0, _ := ret[0].(*iam.UntagOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagOpenIDConnectProvider indicates an expected call of UntagOpenIDConnectProvider. +func (mr *MockIAMAPIMockRecorder) UntagOpenIDConnectProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagOpenIDConnectProvider", reflect.TypeOf((*MockIAMAPI)(nil).UntagOpenIDConnectProvider), arg0) +} + +// UntagOpenIDConnectProviderRequest mocks base method. +func (m *MockIAMAPI) UntagOpenIDConnectProviderRequest(arg0 *iam.UntagOpenIDConnectProviderInput) (*request.Request, *iam.UntagOpenIDConnectProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagOpenIDConnectProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagOpenIDConnectProviderOutput) + return ret0, ret1 +} + +// UntagOpenIDConnectProviderRequest indicates an expected call of UntagOpenIDConnectProviderRequest. +func (mr *MockIAMAPIMockRecorder) UntagOpenIDConnectProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagOpenIDConnectProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagOpenIDConnectProviderRequest), arg0) +} + +// UntagOpenIDConnectProviderWithContext mocks base method. +func (m *MockIAMAPI) UntagOpenIDConnectProviderWithContext(arg0 aws.Context, arg1 *iam.UntagOpenIDConnectProviderInput, arg2 ...request.Option) (*iam.UntagOpenIDConnectProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagOpenIDConnectProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagOpenIDConnectProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagOpenIDConnectProviderWithContext indicates an expected call of UntagOpenIDConnectProviderWithContext. +func (mr *MockIAMAPIMockRecorder) UntagOpenIDConnectProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagOpenIDConnectProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagOpenIDConnectProviderWithContext), varargs...) +} + +// UntagPolicy mocks base method. +func (m *MockIAMAPI) UntagPolicy(arg0 *iam.UntagPolicyInput) (*iam.UntagPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagPolicy", arg0) + ret0, _ := ret[0].(*iam.UntagPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagPolicy indicates an expected call of UntagPolicy. +func (mr *MockIAMAPIMockRecorder) UntagPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagPolicy", reflect.TypeOf((*MockIAMAPI)(nil).UntagPolicy), arg0) +} + +// UntagPolicyRequest mocks base method. +func (m *MockIAMAPI) UntagPolicyRequest(arg0 *iam.UntagPolicyInput) (*request.Request, *iam.UntagPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagPolicyOutput) + return ret0, ret1 +} + +// UntagPolicyRequest indicates an expected call of UntagPolicyRequest. +func (mr *MockIAMAPIMockRecorder) UntagPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagPolicyRequest), arg0) +} + +// UntagPolicyWithContext mocks base method. +func (m *MockIAMAPI) UntagPolicyWithContext(arg0 aws.Context, arg1 *iam.UntagPolicyInput, arg2 ...request.Option) (*iam.UntagPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagPolicyWithContext indicates an expected call of UntagPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) UntagPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagPolicyWithContext), varargs...) +} + +// UntagRole mocks base method. +func (m *MockIAMAPI) UntagRole(arg0 *iam.UntagRoleInput) (*iam.UntagRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagRole", arg0) + ret0, _ := ret[0].(*iam.UntagRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagRole indicates an expected call of UntagRole. +func (mr *MockIAMAPIMockRecorder) UntagRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagRole", reflect.TypeOf((*MockIAMAPI)(nil).UntagRole), arg0) +} + +// UntagRoleRequest mocks base method. +func (m *MockIAMAPI) UntagRoleRequest(arg0 *iam.UntagRoleInput) (*request.Request, *iam.UntagRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagRoleOutput) + return ret0, ret1 +} + +// UntagRoleRequest indicates an expected call of UntagRoleRequest. +func (mr *MockIAMAPIMockRecorder) UntagRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagRoleRequest), arg0) +} + +// UntagRoleWithContext mocks base method. +func (m *MockIAMAPI) UntagRoleWithContext(arg0 aws.Context, arg1 *iam.UntagRoleInput, arg2 ...request.Option) (*iam.UntagRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagRoleWithContext indicates an expected call of UntagRoleWithContext. +func (mr *MockIAMAPIMockRecorder) UntagRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagRoleWithContext), varargs...) +} + +// UntagSAMLProvider mocks base method. +func (m *MockIAMAPI) UntagSAMLProvider(arg0 *iam.UntagSAMLProviderInput) (*iam.UntagSAMLProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagSAMLProvider", arg0) + ret0, _ := ret[0].(*iam.UntagSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagSAMLProvider indicates an expected call of UntagSAMLProvider. +func (mr *MockIAMAPIMockRecorder) UntagSAMLProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagSAMLProvider", reflect.TypeOf((*MockIAMAPI)(nil).UntagSAMLProvider), arg0) +} + +// UntagSAMLProviderRequest mocks base method. +func (m *MockIAMAPI) UntagSAMLProviderRequest(arg0 *iam.UntagSAMLProviderInput) (*request.Request, *iam.UntagSAMLProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagSAMLProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagSAMLProviderOutput) + return ret0, ret1 +} + +// UntagSAMLProviderRequest indicates an expected call of UntagSAMLProviderRequest. +func (mr *MockIAMAPIMockRecorder) UntagSAMLProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagSAMLProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagSAMLProviderRequest), arg0) +} + +// UntagSAMLProviderWithContext mocks base method. +func (m *MockIAMAPI) UntagSAMLProviderWithContext(arg0 aws.Context, arg1 *iam.UntagSAMLProviderInput, arg2 ...request.Option) (*iam.UntagSAMLProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagSAMLProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagSAMLProviderWithContext indicates an expected call of UntagSAMLProviderWithContext. +func (mr *MockIAMAPIMockRecorder) UntagSAMLProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagSAMLProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagSAMLProviderWithContext), varargs...) +} + +// UntagServerCertificate mocks base method. +func (m *MockIAMAPI) UntagServerCertificate(arg0 *iam.UntagServerCertificateInput) (*iam.UntagServerCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagServerCertificate", arg0) + ret0, _ := ret[0].(*iam.UntagServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagServerCertificate indicates an expected call of UntagServerCertificate. +func (mr *MockIAMAPIMockRecorder) UntagServerCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagServerCertificate", reflect.TypeOf((*MockIAMAPI)(nil).UntagServerCertificate), arg0) +} + +// UntagServerCertificateRequest mocks base method. +func (m *MockIAMAPI) UntagServerCertificateRequest(arg0 *iam.UntagServerCertificateInput) (*request.Request, *iam.UntagServerCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagServerCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagServerCertificateOutput) + return ret0, ret1 +} + +// UntagServerCertificateRequest indicates an expected call of UntagServerCertificateRequest. +func (mr *MockIAMAPIMockRecorder) UntagServerCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagServerCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagServerCertificateRequest), arg0) +} + +// UntagServerCertificateWithContext mocks base method. +func (m *MockIAMAPI) UntagServerCertificateWithContext(arg0 aws.Context, arg1 *iam.UntagServerCertificateInput, arg2 ...request.Option) (*iam.UntagServerCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagServerCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagServerCertificateWithContext indicates an expected call of UntagServerCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) UntagServerCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagServerCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagServerCertificateWithContext), varargs...) +} + +// UntagUser mocks base method. +func (m *MockIAMAPI) UntagUser(arg0 *iam.UntagUserInput) (*iam.UntagUserOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagUser", arg0) + ret0, _ := ret[0].(*iam.UntagUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagUser indicates an expected call of UntagUser. +func (mr *MockIAMAPIMockRecorder) UntagUser(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagUser", reflect.TypeOf((*MockIAMAPI)(nil).UntagUser), arg0) +} + +// UntagUserRequest mocks base method. +func (m *MockIAMAPI) UntagUserRequest(arg0 *iam.UntagUserInput) (*request.Request, *iam.UntagUserOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UntagUserRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UntagUserOutput) + return ret0, ret1 +} + +// UntagUserRequest indicates an expected call of UntagUserRequest. +func (mr *MockIAMAPIMockRecorder) UntagUserRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagUserRequest", reflect.TypeOf((*MockIAMAPI)(nil).UntagUserRequest), arg0) +} + +// UntagUserWithContext mocks base method. +func (m *MockIAMAPI) UntagUserWithContext(arg0 aws.Context, arg1 *iam.UntagUserInput, arg2 ...request.Option) (*iam.UntagUserOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UntagUserWithContext", varargs...) + ret0, _ := ret[0].(*iam.UntagUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UntagUserWithContext indicates an expected call of UntagUserWithContext. +func (mr *MockIAMAPIMockRecorder) UntagUserWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UntagUserWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UntagUserWithContext), varargs...) +} + +// UpdateAccessKey mocks base method. +func (m *MockIAMAPI) UpdateAccessKey(arg0 *iam.UpdateAccessKeyInput) (*iam.UpdateAccessKeyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateAccessKey", arg0) + ret0, _ := ret[0].(*iam.UpdateAccessKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateAccessKey indicates an expected call of UpdateAccessKey. +func (mr *MockIAMAPIMockRecorder) UpdateAccessKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAccessKey", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAccessKey), arg0) +} + +// UpdateAccessKeyRequest mocks base method. +func (m *MockIAMAPI) UpdateAccessKeyRequest(arg0 *iam.UpdateAccessKeyInput) (*request.Request, *iam.UpdateAccessKeyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateAccessKeyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateAccessKeyOutput) + return ret0, ret1 +} + +// UpdateAccessKeyRequest indicates an expected call of UpdateAccessKeyRequest. +func (mr *MockIAMAPIMockRecorder) UpdateAccessKeyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAccessKeyRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAccessKeyRequest), arg0) +} + +// UpdateAccessKeyWithContext mocks base method. +func (m *MockIAMAPI) UpdateAccessKeyWithContext(arg0 aws.Context, arg1 *iam.UpdateAccessKeyInput, arg2 ...request.Option) (*iam.UpdateAccessKeyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateAccessKeyWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateAccessKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateAccessKeyWithContext indicates an expected call of UpdateAccessKeyWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateAccessKeyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAccessKeyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAccessKeyWithContext), varargs...) +} + +// UpdateAccountPasswordPolicy mocks base method. +func (m *MockIAMAPI) UpdateAccountPasswordPolicy(arg0 *iam.UpdateAccountPasswordPolicyInput) (*iam.UpdateAccountPasswordPolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateAccountPasswordPolicy", arg0) + ret0, _ := ret[0].(*iam.UpdateAccountPasswordPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateAccountPasswordPolicy indicates an expected call of UpdateAccountPasswordPolicy. +func (mr *MockIAMAPIMockRecorder) UpdateAccountPasswordPolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAccountPasswordPolicy", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAccountPasswordPolicy), arg0) +} + +// UpdateAccountPasswordPolicyRequest mocks base method. +func (m *MockIAMAPI) UpdateAccountPasswordPolicyRequest(arg0 *iam.UpdateAccountPasswordPolicyInput) (*request.Request, *iam.UpdateAccountPasswordPolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateAccountPasswordPolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateAccountPasswordPolicyOutput) + return ret0, ret1 +} + +// UpdateAccountPasswordPolicyRequest indicates an expected call of UpdateAccountPasswordPolicyRequest. +func (mr *MockIAMAPIMockRecorder) UpdateAccountPasswordPolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAccountPasswordPolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAccountPasswordPolicyRequest), arg0) +} + +// UpdateAccountPasswordPolicyWithContext mocks base method. +func (m *MockIAMAPI) UpdateAccountPasswordPolicyWithContext(arg0 aws.Context, arg1 *iam.UpdateAccountPasswordPolicyInput, arg2 ...request.Option) (*iam.UpdateAccountPasswordPolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateAccountPasswordPolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateAccountPasswordPolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateAccountPasswordPolicyWithContext indicates an expected call of UpdateAccountPasswordPolicyWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateAccountPasswordPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAccountPasswordPolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAccountPasswordPolicyWithContext), varargs...) +} + +// UpdateAssumeRolePolicy mocks base method. +func (m *MockIAMAPI) UpdateAssumeRolePolicy(arg0 *iam.UpdateAssumeRolePolicyInput) (*iam.UpdateAssumeRolePolicyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateAssumeRolePolicy", arg0) + ret0, _ := ret[0].(*iam.UpdateAssumeRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateAssumeRolePolicy indicates an expected call of UpdateAssumeRolePolicy. +func (mr *MockIAMAPIMockRecorder) UpdateAssumeRolePolicy(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAssumeRolePolicy", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAssumeRolePolicy), arg0) +} + +// UpdateAssumeRolePolicyRequest mocks base method. +func (m *MockIAMAPI) UpdateAssumeRolePolicyRequest(arg0 *iam.UpdateAssumeRolePolicyInput) (*request.Request, *iam.UpdateAssumeRolePolicyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateAssumeRolePolicyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateAssumeRolePolicyOutput) + return ret0, ret1 +} + +// UpdateAssumeRolePolicyRequest indicates an expected call of UpdateAssumeRolePolicyRequest. +func (mr *MockIAMAPIMockRecorder) UpdateAssumeRolePolicyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAssumeRolePolicyRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAssumeRolePolicyRequest), arg0) +} + +// UpdateAssumeRolePolicyWithContext mocks base method. +func (m *MockIAMAPI) UpdateAssumeRolePolicyWithContext(arg0 aws.Context, arg1 *iam.UpdateAssumeRolePolicyInput, arg2 ...request.Option) (*iam.UpdateAssumeRolePolicyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateAssumeRolePolicyWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateAssumeRolePolicyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateAssumeRolePolicyWithContext indicates an expected call of UpdateAssumeRolePolicyWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateAssumeRolePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAssumeRolePolicyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateAssumeRolePolicyWithContext), varargs...) +} + +// UpdateGroup mocks base method. +func (m *MockIAMAPI) UpdateGroup(arg0 *iam.UpdateGroupInput) (*iam.UpdateGroupOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateGroup", arg0) + ret0, _ := ret[0].(*iam.UpdateGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateGroup indicates an expected call of UpdateGroup. +func (mr *MockIAMAPIMockRecorder) UpdateGroup(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGroup", reflect.TypeOf((*MockIAMAPI)(nil).UpdateGroup), arg0) +} + +// UpdateGroupRequest mocks base method. +func (m *MockIAMAPI) UpdateGroupRequest(arg0 *iam.UpdateGroupInput) (*request.Request, *iam.UpdateGroupOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateGroupRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateGroupOutput) + return ret0, ret1 +} + +// UpdateGroupRequest indicates an expected call of UpdateGroupRequest. +func (mr *MockIAMAPIMockRecorder) UpdateGroupRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGroupRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateGroupRequest), arg0) +} + +// UpdateGroupWithContext mocks base method. +func (m *MockIAMAPI) UpdateGroupWithContext(arg0 aws.Context, arg1 *iam.UpdateGroupInput, arg2 ...request.Option) (*iam.UpdateGroupOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateGroupWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateGroupOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateGroupWithContext indicates an expected call of UpdateGroupWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateGroupWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGroupWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateGroupWithContext), varargs...) +} + +// UpdateLoginProfile mocks base method. +func (m *MockIAMAPI) UpdateLoginProfile(arg0 *iam.UpdateLoginProfileInput) (*iam.UpdateLoginProfileOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateLoginProfile", arg0) + ret0, _ := ret[0].(*iam.UpdateLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateLoginProfile indicates an expected call of UpdateLoginProfile. +func (mr *MockIAMAPIMockRecorder) UpdateLoginProfile(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoginProfile", reflect.TypeOf((*MockIAMAPI)(nil).UpdateLoginProfile), arg0) +} + +// UpdateLoginProfileRequest mocks base method. +func (m *MockIAMAPI) UpdateLoginProfileRequest(arg0 *iam.UpdateLoginProfileInput) (*request.Request, *iam.UpdateLoginProfileOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateLoginProfileRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateLoginProfileOutput) + return ret0, ret1 +} + +// UpdateLoginProfileRequest indicates an expected call of UpdateLoginProfileRequest. +func (mr *MockIAMAPIMockRecorder) UpdateLoginProfileRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoginProfileRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateLoginProfileRequest), arg0) +} + +// UpdateLoginProfileWithContext mocks base method. +func (m *MockIAMAPI) UpdateLoginProfileWithContext(arg0 aws.Context, arg1 *iam.UpdateLoginProfileInput, arg2 ...request.Option) (*iam.UpdateLoginProfileOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateLoginProfileWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateLoginProfileOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateLoginProfileWithContext indicates an expected call of UpdateLoginProfileWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateLoginProfileWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoginProfileWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateLoginProfileWithContext), varargs...) +} + +// UpdateOpenIDConnectProviderThumbprint mocks base method. +func (m *MockIAMAPI) UpdateOpenIDConnectProviderThumbprint(arg0 *iam.UpdateOpenIDConnectProviderThumbprintInput) (*iam.UpdateOpenIDConnectProviderThumbprintOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateOpenIDConnectProviderThumbprint", arg0) + ret0, _ := ret[0].(*iam.UpdateOpenIDConnectProviderThumbprintOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateOpenIDConnectProviderThumbprint indicates an expected call of UpdateOpenIDConnectProviderThumbprint. +func (mr *MockIAMAPIMockRecorder) UpdateOpenIDConnectProviderThumbprint(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateOpenIDConnectProviderThumbprint", reflect.TypeOf((*MockIAMAPI)(nil).UpdateOpenIDConnectProviderThumbprint), arg0) +} + +// UpdateOpenIDConnectProviderThumbprintRequest mocks base method. +func (m *MockIAMAPI) UpdateOpenIDConnectProviderThumbprintRequest(arg0 *iam.UpdateOpenIDConnectProviderThumbprintInput) (*request.Request, *iam.UpdateOpenIDConnectProviderThumbprintOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateOpenIDConnectProviderThumbprintRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateOpenIDConnectProviderThumbprintOutput) + return ret0, ret1 +} + +// UpdateOpenIDConnectProviderThumbprintRequest indicates an expected call of UpdateOpenIDConnectProviderThumbprintRequest. +func (mr *MockIAMAPIMockRecorder) UpdateOpenIDConnectProviderThumbprintRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateOpenIDConnectProviderThumbprintRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateOpenIDConnectProviderThumbprintRequest), arg0) +} + +// UpdateOpenIDConnectProviderThumbprintWithContext mocks base method. +func (m *MockIAMAPI) UpdateOpenIDConnectProviderThumbprintWithContext(arg0 aws.Context, arg1 *iam.UpdateOpenIDConnectProviderThumbprintInput, arg2 ...request.Option) (*iam.UpdateOpenIDConnectProviderThumbprintOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateOpenIDConnectProviderThumbprintWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateOpenIDConnectProviderThumbprintOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateOpenIDConnectProviderThumbprintWithContext indicates an expected call of UpdateOpenIDConnectProviderThumbprintWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateOpenIDConnectProviderThumbprintWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateOpenIDConnectProviderThumbprintWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateOpenIDConnectProviderThumbprintWithContext), varargs...) +} + +// UpdateRole mocks base method. +func (m *MockIAMAPI) UpdateRole(arg0 *iam.UpdateRoleInput) (*iam.UpdateRoleOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRole", arg0) + ret0, _ := ret[0].(*iam.UpdateRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateRole indicates an expected call of UpdateRole. +func (mr *MockIAMAPIMockRecorder) UpdateRole(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRole", reflect.TypeOf((*MockIAMAPI)(nil).UpdateRole), arg0) +} + +// UpdateRoleDescription mocks base method. +func (m *MockIAMAPI) UpdateRoleDescription(arg0 *iam.UpdateRoleDescriptionInput) (*iam.UpdateRoleDescriptionOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRoleDescription", arg0) + ret0, _ := ret[0].(*iam.UpdateRoleDescriptionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateRoleDescription indicates an expected call of UpdateRoleDescription. +func (mr *MockIAMAPIMockRecorder) UpdateRoleDescription(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRoleDescription", reflect.TypeOf((*MockIAMAPI)(nil).UpdateRoleDescription), arg0) +} + +// UpdateRoleDescriptionRequest mocks base method. +func (m *MockIAMAPI) UpdateRoleDescriptionRequest(arg0 *iam.UpdateRoleDescriptionInput) (*request.Request, *iam.UpdateRoleDescriptionOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRoleDescriptionRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateRoleDescriptionOutput) + return ret0, ret1 +} + +// UpdateRoleDescriptionRequest indicates an expected call of UpdateRoleDescriptionRequest. +func (mr *MockIAMAPIMockRecorder) UpdateRoleDescriptionRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRoleDescriptionRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateRoleDescriptionRequest), arg0) +} + +// UpdateRoleDescriptionWithContext mocks base method. +func (m *MockIAMAPI) UpdateRoleDescriptionWithContext(arg0 aws.Context, arg1 *iam.UpdateRoleDescriptionInput, arg2 ...request.Option) (*iam.UpdateRoleDescriptionOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateRoleDescriptionWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateRoleDescriptionOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateRoleDescriptionWithContext indicates an expected call of UpdateRoleDescriptionWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateRoleDescriptionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRoleDescriptionWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateRoleDescriptionWithContext), varargs...) +} + +// UpdateRoleRequest mocks base method. +func (m *MockIAMAPI) UpdateRoleRequest(arg0 *iam.UpdateRoleInput) (*request.Request, *iam.UpdateRoleOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRoleRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateRoleOutput) + return ret0, ret1 +} + +// UpdateRoleRequest indicates an expected call of UpdateRoleRequest. +func (mr *MockIAMAPIMockRecorder) UpdateRoleRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRoleRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateRoleRequest), arg0) +} + +// UpdateRoleWithContext mocks base method. +func (m *MockIAMAPI) UpdateRoleWithContext(arg0 aws.Context, arg1 *iam.UpdateRoleInput, arg2 ...request.Option) (*iam.UpdateRoleOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateRoleWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateRoleOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateRoleWithContext indicates an expected call of UpdateRoleWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateRoleWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRoleWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateRoleWithContext), varargs...) +} + +// UpdateSAMLProvider mocks base method. +func (m *MockIAMAPI) UpdateSAMLProvider(arg0 *iam.UpdateSAMLProviderInput) (*iam.UpdateSAMLProviderOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSAMLProvider", arg0) + ret0, _ := ret[0].(*iam.UpdateSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSAMLProvider indicates an expected call of UpdateSAMLProvider. +func (mr *MockIAMAPIMockRecorder) UpdateSAMLProvider(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSAMLProvider", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSAMLProvider), arg0) +} + +// UpdateSAMLProviderRequest mocks base method. +func (m *MockIAMAPI) UpdateSAMLProviderRequest(arg0 *iam.UpdateSAMLProviderInput) (*request.Request, *iam.UpdateSAMLProviderOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSAMLProviderRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateSAMLProviderOutput) + return ret0, ret1 +} + +// UpdateSAMLProviderRequest indicates an expected call of UpdateSAMLProviderRequest. +func (mr *MockIAMAPIMockRecorder) UpdateSAMLProviderRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSAMLProviderRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSAMLProviderRequest), arg0) +} + +// UpdateSAMLProviderWithContext mocks base method. +func (m *MockIAMAPI) UpdateSAMLProviderWithContext(arg0 aws.Context, arg1 *iam.UpdateSAMLProviderInput, arg2 ...request.Option) (*iam.UpdateSAMLProviderOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateSAMLProviderWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateSAMLProviderOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSAMLProviderWithContext indicates an expected call of UpdateSAMLProviderWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateSAMLProviderWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSAMLProviderWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSAMLProviderWithContext), varargs...) +} + +// UpdateSSHPublicKey mocks base method. +func (m *MockIAMAPI) UpdateSSHPublicKey(arg0 *iam.UpdateSSHPublicKeyInput) (*iam.UpdateSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSSHPublicKey", arg0) + ret0, _ := ret[0].(*iam.UpdateSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSSHPublicKey indicates an expected call of UpdateSSHPublicKey. +func (mr *MockIAMAPIMockRecorder) UpdateSSHPublicKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSSHPublicKey", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSSHPublicKey), arg0) +} + +// UpdateSSHPublicKeyRequest mocks base method. +func (m *MockIAMAPI) UpdateSSHPublicKeyRequest(arg0 *iam.UpdateSSHPublicKeyInput) (*request.Request, *iam.UpdateSSHPublicKeyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSSHPublicKeyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateSSHPublicKeyOutput) + return ret0, ret1 +} + +// UpdateSSHPublicKeyRequest indicates an expected call of UpdateSSHPublicKeyRequest. +func (mr *MockIAMAPIMockRecorder) UpdateSSHPublicKeyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSSHPublicKeyRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSSHPublicKeyRequest), arg0) +} + +// UpdateSSHPublicKeyWithContext mocks base method. +func (m *MockIAMAPI) UpdateSSHPublicKeyWithContext(arg0 aws.Context, arg1 *iam.UpdateSSHPublicKeyInput, arg2 ...request.Option) (*iam.UpdateSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateSSHPublicKeyWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSSHPublicKeyWithContext indicates an expected call of UpdateSSHPublicKeyWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateSSHPublicKeyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSSHPublicKeyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSSHPublicKeyWithContext), varargs...) +} + +// UpdateServerCertificate mocks base method. +func (m *MockIAMAPI) UpdateServerCertificate(arg0 *iam.UpdateServerCertificateInput) (*iam.UpdateServerCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateServerCertificate", arg0) + ret0, _ := ret[0].(*iam.UpdateServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateServerCertificate indicates an expected call of UpdateServerCertificate. +func (mr *MockIAMAPIMockRecorder) UpdateServerCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServerCertificate", reflect.TypeOf((*MockIAMAPI)(nil).UpdateServerCertificate), arg0) +} + +// UpdateServerCertificateRequest mocks base method. +func (m *MockIAMAPI) UpdateServerCertificateRequest(arg0 *iam.UpdateServerCertificateInput) (*request.Request, *iam.UpdateServerCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateServerCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateServerCertificateOutput) + return ret0, ret1 +} + +// UpdateServerCertificateRequest indicates an expected call of UpdateServerCertificateRequest. +func (mr *MockIAMAPIMockRecorder) UpdateServerCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServerCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateServerCertificateRequest), arg0) +} + +// UpdateServerCertificateWithContext mocks base method. +func (m *MockIAMAPI) UpdateServerCertificateWithContext(arg0 aws.Context, arg1 *iam.UpdateServerCertificateInput, arg2 ...request.Option) (*iam.UpdateServerCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateServerCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateServerCertificateWithContext indicates an expected call of UpdateServerCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateServerCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServerCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateServerCertificateWithContext), varargs...) +} + +// UpdateServiceSpecificCredential mocks base method. +func (m *MockIAMAPI) UpdateServiceSpecificCredential(arg0 *iam.UpdateServiceSpecificCredentialInput) (*iam.UpdateServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateServiceSpecificCredential", arg0) + ret0, _ := ret[0].(*iam.UpdateServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateServiceSpecificCredential indicates an expected call of UpdateServiceSpecificCredential. +func (mr *MockIAMAPIMockRecorder) UpdateServiceSpecificCredential(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServiceSpecificCredential", reflect.TypeOf((*MockIAMAPI)(nil).UpdateServiceSpecificCredential), arg0) +} + +// UpdateServiceSpecificCredentialRequest mocks base method. +func (m *MockIAMAPI) UpdateServiceSpecificCredentialRequest(arg0 *iam.UpdateServiceSpecificCredentialInput) (*request.Request, *iam.UpdateServiceSpecificCredentialOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateServiceSpecificCredentialRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateServiceSpecificCredentialOutput) + return ret0, ret1 +} + +// UpdateServiceSpecificCredentialRequest indicates an expected call of UpdateServiceSpecificCredentialRequest. +func (mr *MockIAMAPIMockRecorder) UpdateServiceSpecificCredentialRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServiceSpecificCredentialRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateServiceSpecificCredentialRequest), arg0) +} + +// UpdateServiceSpecificCredentialWithContext mocks base method. +func (m *MockIAMAPI) UpdateServiceSpecificCredentialWithContext(arg0 aws.Context, arg1 *iam.UpdateServiceSpecificCredentialInput, arg2 ...request.Option) (*iam.UpdateServiceSpecificCredentialOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateServiceSpecificCredentialWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateServiceSpecificCredentialOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateServiceSpecificCredentialWithContext indicates an expected call of UpdateServiceSpecificCredentialWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateServiceSpecificCredentialWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateServiceSpecificCredentialWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateServiceSpecificCredentialWithContext), varargs...) +} + +// UpdateSigningCertificate mocks base method. +func (m *MockIAMAPI) UpdateSigningCertificate(arg0 *iam.UpdateSigningCertificateInput) (*iam.UpdateSigningCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSigningCertificate", arg0) + ret0, _ := ret[0].(*iam.UpdateSigningCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSigningCertificate indicates an expected call of UpdateSigningCertificate. +func (mr *MockIAMAPIMockRecorder) UpdateSigningCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSigningCertificate", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSigningCertificate), arg0) +} + +// UpdateSigningCertificateRequest mocks base method. +func (m *MockIAMAPI) UpdateSigningCertificateRequest(arg0 *iam.UpdateSigningCertificateInput) (*request.Request, *iam.UpdateSigningCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSigningCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateSigningCertificateOutput) + return ret0, ret1 +} + +// UpdateSigningCertificateRequest indicates an expected call of UpdateSigningCertificateRequest. +func (mr *MockIAMAPIMockRecorder) UpdateSigningCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSigningCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSigningCertificateRequest), arg0) +} + +// UpdateSigningCertificateWithContext mocks base method. +func (m *MockIAMAPI) UpdateSigningCertificateWithContext(arg0 aws.Context, arg1 *iam.UpdateSigningCertificateInput, arg2 ...request.Option) (*iam.UpdateSigningCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateSigningCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateSigningCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSigningCertificateWithContext indicates an expected call of UpdateSigningCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateSigningCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSigningCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateSigningCertificateWithContext), varargs...) +} + +// UpdateUser mocks base method. +func (m *MockIAMAPI) UpdateUser(arg0 *iam.UpdateUserInput) (*iam.UpdateUserOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateUser", arg0) + ret0, _ := ret[0].(*iam.UpdateUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateUser indicates an expected call of UpdateUser. +func (mr *MockIAMAPIMockRecorder) UpdateUser(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUser", reflect.TypeOf((*MockIAMAPI)(nil).UpdateUser), arg0) +} + +// UpdateUserRequest mocks base method. +func (m *MockIAMAPI) UpdateUserRequest(arg0 *iam.UpdateUserInput) (*request.Request, *iam.UpdateUserOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateUserRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UpdateUserOutput) + return ret0, ret1 +} + +// UpdateUserRequest indicates an expected call of UpdateUserRequest. +func (mr *MockIAMAPIMockRecorder) UpdateUserRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUserRequest", reflect.TypeOf((*MockIAMAPI)(nil).UpdateUserRequest), arg0) +} + +// UpdateUserWithContext mocks base method. +func (m *MockIAMAPI) UpdateUserWithContext(arg0 aws.Context, arg1 *iam.UpdateUserInput, arg2 ...request.Option) (*iam.UpdateUserOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateUserWithContext", varargs...) + ret0, _ := ret[0].(*iam.UpdateUserOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateUserWithContext indicates an expected call of UpdateUserWithContext. +func (mr *MockIAMAPIMockRecorder) UpdateUserWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUserWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UpdateUserWithContext), varargs...) +} + +// UploadSSHPublicKey mocks base method. +func (m *MockIAMAPI) UploadSSHPublicKey(arg0 *iam.UploadSSHPublicKeyInput) (*iam.UploadSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadSSHPublicKey", arg0) + ret0, _ := ret[0].(*iam.UploadSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UploadSSHPublicKey indicates an expected call of UploadSSHPublicKey. +func (mr *MockIAMAPIMockRecorder) UploadSSHPublicKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadSSHPublicKey", reflect.TypeOf((*MockIAMAPI)(nil).UploadSSHPublicKey), arg0) +} + +// UploadSSHPublicKeyRequest mocks base method. +func (m *MockIAMAPI) UploadSSHPublicKeyRequest(arg0 *iam.UploadSSHPublicKeyInput) (*request.Request, *iam.UploadSSHPublicKeyOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadSSHPublicKeyRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UploadSSHPublicKeyOutput) + return ret0, ret1 +} + +// UploadSSHPublicKeyRequest indicates an expected call of UploadSSHPublicKeyRequest. +func (mr *MockIAMAPIMockRecorder) UploadSSHPublicKeyRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadSSHPublicKeyRequest", reflect.TypeOf((*MockIAMAPI)(nil).UploadSSHPublicKeyRequest), arg0) +} + +// UploadSSHPublicKeyWithContext mocks base method. +func (m *MockIAMAPI) UploadSSHPublicKeyWithContext(arg0 aws.Context, arg1 *iam.UploadSSHPublicKeyInput, arg2 ...request.Option) (*iam.UploadSSHPublicKeyOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UploadSSHPublicKeyWithContext", varargs...) + ret0, _ := ret[0].(*iam.UploadSSHPublicKeyOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UploadSSHPublicKeyWithContext indicates an expected call of UploadSSHPublicKeyWithContext. +func (mr *MockIAMAPIMockRecorder) UploadSSHPublicKeyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadSSHPublicKeyWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UploadSSHPublicKeyWithContext), varargs...) +} + +// UploadServerCertificate mocks base method. +func (m *MockIAMAPI) UploadServerCertificate(arg0 *iam.UploadServerCertificateInput) (*iam.UploadServerCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadServerCertificate", arg0) + ret0, _ := ret[0].(*iam.UploadServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UploadServerCertificate indicates an expected call of UploadServerCertificate. +func (mr *MockIAMAPIMockRecorder) UploadServerCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadServerCertificate", reflect.TypeOf((*MockIAMAPI)(nil).UploadServerCertificate), arg0) +} + +// UploadServerCertificateRequest mocks base method. +func (m *MockIAMAPI) UploadServerCertificateRequest(arg0 *iam.UploadServerCertificateInput) (*request.Request, *iam.UploadServerCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadServerCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UploadServerCertificateOutput) + return ret0, ret1 +} + +// UploadServerCertificateRequest indicates an expected call of UploadServerCertificateRequest. +func (mr *MockIAMAPIMockRecorder) UploadServerCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadServerCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).UploadServerCertificateRequest), arg0) +} + +// UploadServerCertificateWithContext mocks base method. +func (m *MockIAMAPI) UploadServerCertificateWithContext(arg0 aws.Context, arg1 *iam.UploadServerCertificateInput, arg2 ...request.Option) (*iam.UploadServerCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UploadServerCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.UploadServerCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UploadServerCertificateWithContext indicates an expected call of UploadServerCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) UploadServerCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadServerCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UploadServerCertificateWithContext), varargs...) +} + +// UploadSigningCertificate mocks base method. +func (m *MockIAMAPI) UploadSigningCertificate(arg0 *iam.UploadSigningCertificateInput) (*iam.UploadSigningCertificateOutput, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadSigningCertificate", arg0) + ret0, _ := ret[0].(*iam.UploadSigningCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UploadSigningCertificate indicates an expected call of UploadSigningCertificate. +func (mr *MockIAMAPIMockRecorder) UploadSigningCertificate(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadSigningCertificate", reflect.TypeOf((*MockIAMAPI)(nil).UploadSigningCertificate), arg0) +} + +// UploadSigningCertificateRequest mocks base method. +func (m *MockIAMAPI) UploadSigningCertificateRequest(arg0 *iam.UploadSigningCertificateInput) (*request.Request, *iam.UploadSigningCertificateOutput) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UploadSigningCertificateRequest", arg0) + ret0, _ := ret[0].(*request.Request) + ret1, _ := ret[1].(*iam.UploadSigningCertificateOutput) + return ret0, ret1 +} + +// UploadSigningCertificateRequest indicates an expected call of UploadSigningCertificateRequest. +func (mr *MockIAMAPIMockRecorder) UploadSigningCertificateRequest(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadSigningCertificateRequest", reflect.TypeOf((*MockIAMAPI)(nil).UploadSigningCertificateRequest), arg0) +} + +// UploadSigningCertificateWithContext mocks base method. +func (m *MockIAMAPI) UploadSigningCertificateWithContext(arg0 aws.Context, arg1 *iam.UploadSigningCertificateInput, arg2 ...request.Option) (*iam.UploadSigningCertificateOutput, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UploadSigningCertificateWithContext", varargs...) + ret0, _ := ret[0].(*iam.UploadSigningCertificateOutput) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UploadSigningCertificateWithContext indicates an expected call of UploadSigningCertificateWithContext. +func (mr *MockIAMAPIMockRecorder) UploadSigningCertificateWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadSigningCertificateWithContext", reflect.TypeOf((*MockIAMAPI)(nil).UploadSigningCertificateWithContext), varargs...) +} + +// WaitUntilInstanceProfileExists mocks base method. +func (m *MockIAMAPI) WaitUntilInstanceProfileExists(arg0 *iam.GetInstanceProfileInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilInstanceProfileExists", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilInstanceProfileExists indicates an expected call of WaitUntilInstanceProfileExists. +func (mr *MockIAMAPIMockRecorder) WaitUntilInstanceProfileExists(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilInstanceProfileExists", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilInstanceProfileExists), arg0) +} + +// WaitUntilInstanceProfileExistsWithContext mocks base method. +func (m *MockIAMAPI) WaitUntilInstanceProfileExistsWithContext(arg0 aws.Context, arg1 *iam.GetInstanceProfileInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilInstanceProfileExistsWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilInstanceProfileExistsWithContext indicates an expected call of WaitUntilInstanceProfileExistsWithContext. +func (mr *MockIAMAPIMockRecorder) WaitUntilInstanceProfileExistsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilInstanceProfileExistsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilInstanceProfileExistsWithContext), varargs...) +} + +// WaitUntilPolicyExists mocks base method. +func (m *MockIAMAPI) WaitUntilPolicyExists(arg0 *iam.GetPolicyInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilPolicyExists", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilPolicyExists indicates an expected call of WaitUntilPolicyExists. +func (mr *MockIAMAPIMockRecorder) WaitUntilPolicyExists(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilPolicyExists", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilPolicyExists), arg0) +} + +// WaitUntilPolicyExistsWithContext mocks base method. +func (m *MockIAMAPI) WaitUntilPolicyExistsWithContext(arg0 aws.Context, arg1 *iam.GetPolicyInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilPolicyExistsWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilPolicyExistsWithContext indicates an expected call of WaitUntilPolicyExistsWithContext. +func (mr *MockIAMAPIMockRecorder) WaitUntilPolicyExistsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilPolicyExistsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilPolicyExistsWithContext), varargs...) +} + +// WaitUntilRoleExists mocks base method. +func (m *MockIAMAPI) WaitUntilRoleExists(arg0 *iam.GetRoleInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilRoleExists", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilRoleExists indicates an expected call of WaitUntilRoleExists. +func (mr *MockIAMAPIMockRecorder) WaitUntilRoleExists(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilRoleExists", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilRoleExists), arg0) +} + +// WaitUntilRoleExistsWithContext mocks base method. +func (m *MockIAMAPI) WaitUntilRoleExistsWithContext(arg0 aws.Context, arg1 *iam.GetRoleInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilRoleExistsWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilRoleExistsWithContext indicates an expected call of WaitUntilRoleExistsWithContext. +func (mr *MockIAMAPIMockRecorder) WaitUntilRoleExistsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilRoleExistsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilRoleExistsWithContext), varargs...) +} + +// WaitUntilUserExists mocks base method. +func (m *MockIAMAPI) WaitUntilUserExists(arg0 *iam.GetUserInput) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitUntilUserExists", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilUserExists indicates an expected call of WaitUntilUserExists. +func (mr *MockIAMAPIMockRecorder) WaitUntilUserExists(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilUserExists", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilUserExists), arg0) +} + +// WaitUntilUserExistsWithContext mocks base method. +func (m *MockIAMAPI) WaitUntilUserExistsWithContext(arg0 aws.Context, arg1 *iam.GetUserInput, arg2 ...request.WaiterOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitUntilUserExistsWithContext", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// WaitUntilUserExistsWithContext indicates an expected call of WaitUntilUserExistsWithContext. +func (mr *MockIAMAPIMockRecorder) WaitUntilUserExistsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitUntilUserExistsWithContext", reflect.TypeOf((*MockIAMAPI)(nil).WaitUntilUserExistsWithContext), varargs...) +} diff --git a/pkg/awsutil/account.go b/pkg/awsutil/account.go index c7496f7e6..19a8ae302 100644 --- a/pkg/awsutil/account.go +++ b/pkg/awsutil/account.go @@ -5,8 +5,8 @@ import ( "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/sts" + "github.com/ekristen/aws-nuke/pkg/config" "github.com/pkg/errors" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" ) type Account struct { @@ -56,7 +56,7 @@ func NewAccount(creds Credentials, endpoints config.CustomEndpoints) (*Account, return nil, errors.Wrap(err, "failed get account alias") } - aliases := []string{} + var aliases []string for _, alias := range aliasesOutput.AccountAliases { if alias != nil { aliases = append(aliases, *alias) diff --git a/pkg/awsutil/errors.go b/pkg/awsutil/errors.go deleted file mode 100644 index 543f699a7..000000000 --- a/pkg/awsutil/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package awsutil - -type ErrSkipRequest string - -func (err ErrSkipRequest) Error() string { - return string(err) -} - -type ErrUnknownEndpoint string - -func (err ErrUnknownEndpoint) Error() string { - return string(err) -} diff --git a/pkg/awsutil/session.go b/pkg/awsutil/session.go index f420df771..64d663655 100644 --- a/pkg/awsutil/session.go +++ b/pkg/awsutil/session.go @@ -14,7 +14,8 @@ import ( "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3control" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" + "github.com/ekristen/aws-nuke/pkg/config" + sdkerrors "github.com/ekristen/libnuke/pkg/errors" log "github.com/sirupsen/logrus" ) @@ -101,7 +102,6 @@ func (c *Credentials) rootSession() (*session.Session, error) { Profile: c.Profile, AssumeRoleTokenProvider: stscreds.StdinTokenProvider, } - } opts.Config.Region = aws.String(region) @@ -149,7 +149,7 @@ func (c *Credentials) NewSession(region, serviceType string) (*session.Session, if customRegion := c.CustomEndpoints.GetRegion(region); customRegion != nil { customService := customRegion.Services.GetService(serviceType) if customService == nil { - return nil, ErrSkipRequest(fmt.Sprintf( + return nil, sdkerrors.ErrSkipRequest(fmt.Sprintf( ".service '%s' is not available in region '%s'", serviceType, region)) } @@ -185,11 +185,11 @@ func (c *Credentials) NewSession(region, serviceType string) (*session.Session, } sess.Handlers.Send.PushFront(func(r *request.Request) { - log.Debugf("sending AWS request:\n%s", DumpRequest(r.HTTPRequest)) + log.Tracef("sending AWS request:\n%s", DumpRequest(r.HTTPRequest)) }) sess.Handlers.ValidateResponse.PushFront(func(r *request.Request) { - log.Debugf("received AWS response:\n%s", DumpResponse(r.HTTPResponse)) + log.Tracef("received AWS response:\n%s", DumpResponse(r.HTTPResponse)) }) if !isCustom { @@ -216,7 +216,7 @@ func skipMissingServiceInRegionHandler(r *request.Request) { _, ok = rs[region] if !ok { - r.Error = ErrSkipRequest(fmt.Sprintf( + r.Error = sdkerrors.ErrSkipRequest(fmt.Sprintf( "service '%s' is not available in region '%s'", service, region)) } @@ -234,25 +234,25 @@ func skipGlobalHandler(global bool) func(r *request.Request) { if !ok { // This means that the service does not exist in the endpoints list. if global { - r.Error = ErrSkipRequest(fmt.Sprintf("service '%s' is was not found in the endpoint list; assuming it is not global", service)) + r.Error = sdkerrors.ErrSkipRequest(fmt.Sprintf("service '%s' is was not found in the endpoint list; assuming it is not global", service)) } else { host := r.HTTPRequest.URL.Hostname() _, err := net.LookupHost(host) if err != nil { log.Debug(err) - r.Error = ErrUnknownEndpoint(fmt.Sprintf("DNS lookup failed for %s; assuming it does not exist in this region", host)) + r.Error = sdkerrors.ErrUnknownEndpoint(fmt.Sprintf("DNS lookup failed for %s; assuming it does not exist in this region", host)) } } return } if len(rs) == 0 && !global { - r.Error = ErrSkipRequest(fmt.Sprintf("service '%s' is global, but the session is not", service)) + r.Error = sdkerrors.ErrSkipRequest(fmt.Sprintf("service '%s' is global, but the session is not", service)) return } if (len(rs) > 0 && global) && service != "sts" { - r.Error = ErrSkipRequest(fmt.Sprintf("service '%s' is not global, but the session is", service)) + r.Error = sdkerrors.ErrSkipRequest(fmt.Sprintf("service '%s' is not global, but the session is", service)) return } } diff --git a/pkg/awsutil/util.go b/pkg/awsutil/util.go index 4ad9faca9..460c1e0bf 100644 --- a/pkg/awsutil/util.go +++ b/pkg/awsutil/util.go @@ -2,11 +2,13 @@ package awsutil import ( "bytes" + "errors" + "github.com/aws/aws-sdk-go/aws/awserr" "net/http" "net/http/httputil" "regexp" - "github.com/rebuy-de/aws-nuke/v2/pkg/util" + "github.com/ekristen/libnuke/pkg/utils" log "github.com/sirupsen/logrus" ) @@ -28,7 +30,7 @@ func DumpRequest(r *http.Request) string { dump = bytes.TrimSpace(dump) dump = HideSecureHeaders(dump) - dump = util.IndentBytes(dump, []byte(" > ")) + dump = utils.IndentBytes(dump, []byte(" > ")) return string(dump) } @@ -41,6 +43,16 @@ func DumpResponse(r *http.Response) string { } dump = bytes.TrimSpace(dump) - dump = util.IndentBytes(dump, []byte(" < ")) + dump = utils.IndentBytes(dump, []byte(" < ")) return string(dump) } + +func IsAWSError(err error, code string) bool { + var aerr awserr.Error + ok := errors.As(err, &aerr) + if !ok { + return false + } + + return aerr.Code() == code +} diff --git a/pkg/awsutil/util_test.go b/pkg/awsutil/util_test.go index 452eb4faa..7dc03551c 100644 --- a/pkg/awsutil/util_test.go +++ b/pkg/awsutil/util_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/rebuy-de/aws-nuke/v2/pkg/awsutil" + "github.com/ekristen/aws-nuke/pkg/awsutil" ) func TestSecretRegex(t *testing.T) { diff --git a/pkg/commands/global/global.go b/pkg/commands/global/global.go new file mode 100644 index 000000000..d104fe839 --- /dev/null +++ b/pkg/commands/global/global.go @@ -0,0 +1,67 @@ +package global + +import ( + "fmt" + "path" + "runtime" + + "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" +) + +func Flags() []cli.Flag { + globalFlags := []cli.Flag{ + &cli.StringFlag{ + Name: "log-level", + Usage: "Log Level", + Aliases: []string{"l"}, + EnvVars: []string{"LOGLEVEL"}, + Value: "info", + }, + &cli.BoolFlag{ + Name: "log-caller", + Usage: "log the caller (aka line number and file)", + }, + &cli.BoolFlag{ + Name: "log-disable-color", + Usage: "disable log coloring", + }, + &cli.BoolFlag{ + Name: "log-full-timestamp", + Usage: "force log output to always show full timestamp", + }, + } + + return globalFlags +} + +func Before(c *cli.Context) error { + formatter := &logrus.TextFormatter{ + DisableColors: c.Bool("log-disable-color"), + FullTimestamp: c.Bool("log-full-timestamp"), + } + if c.Bool("log-caller") { + logrus.SetReportCaller(true) + + formatter.CallerPrettyfier = func(f *runtime.Frame) (string, string) { + return "", fmt.Sprintf("%s:%d", path.Base(f.File), f.Line) + } + } + + logrus.SetFormatter(formatter) + + switch c.String("log-level") { + case "trace": + logrus.SetLevel(logrus.TraceLevel) + case "debug": + logrus.SetLevel(logrus.DebugLevel) + case "info": + logrus.SetLevel(logrus.InfoLevel) + case "warn": + logrus.SetLevel(logrus.WarnLevel) + case "error": + logrus.SetLevel(logrus.ErrorLevel) + } + + return nil +} diff --git a/pkg/commands/list/list.go b/pkg/commands/list/list.go new file mode 100644 index 000000000..ebd19af6d --- /dev/null +++ b/pkg/commands/list/list.go @@ -0,0 +1,36 @@ +package list + +import ( + "fmt" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/urfave/cli/v2" + + "github.com/ekristen/aws-nuke/pkg/commands/global" + "github.com/ekristen/aws-nuke/pkg/common" + + _ "github.com/ekristen/aws-nuke/resources" +) + +func execute(c *cli.Context) error { + ls := resource.GetListersForScope(nuke.Account) + + for name, _ := range ls { + fmt.Println(name) + } + + return nil +} + +func init() { + cmd := &cli.Command{ + Name: "resource-types", + Aliases: []string{"list-resources"}, + Usage: "list available resources to nuke", + Flags: global.Flags(), + Before: global.Before, + Action: execute, + } + + common.RegisterCommand(cmd) +} diff --git a/pkg/commands/nuke/command.go b/pkg/commands/nuke/command.go new file mode 100644 index 000000000..555e07617 --- /dev/null +++ b/pkg/commands/nuke/command.go @@ -0,0 +1,200 @@ +package nuke + +import ( + "context" + "fmt" + "os" + + "github.com/aws/aws-sdk-go/aws/endpoints" + + "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" + + sdknuke "github.com/ekristen/libnuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/awsutil" + "github.com/ekristen/aws-nuke/pkg/commands/global" + "github.com/ekristen/aws-nuke/pkg/common" + "github.com/ekristen/aws-nuke/pkg/config" + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +func execute(c *cli.Context) error { + ctx, cancel := context.WithCancel(c.Context) + defer cancel() + + _ = ctx + + var ( + err error + creds awsutil.Credentials + defaultRegion string + ) + + if !creds.HasKeys() && !creds.HasProfile() && defaultRegion != "" { + creds.AccessKeyID = os.Getenv("AWS_ACCESS_KEY_ID") + creds.SecretAccessKey = os.Getenv("AWS_SECRET_ACCESS_KEY") + } + err = creds.Validate() + if err != nil { + return err + } + + params := nuke.Parameters{ + Parameters: sdknuke.Parameters{ + Force: c.Bool("force"), + ForceSleep: c.Int("force-sleep"), + Quiet: c.Bool("quiet"), + NoDryRun: c.Bool("no-dry-run"), + }, + Targets: c.StringSlice("only-resource"), + Excludes: c.StringSlice("exclude-resource"), + CloudControl: c.StringSlice("cloud-control"), + } + + parsedConfig, err := config.Load(c.Path("config")) + if err != nil { + logrus.Errorf("Failed to parse config file %s", c.Path("config")) + return err + } + + if defaultRegion != "" { + awsutil.DefaultRegionID = defaultRegion + switch defaultRegion { + case endpoints.UsEast1RegionID, endpoints.UsEast2RegionID, endpoints.UsWest1RegionID, endpoints.UsWest2RegionID: + awsutil.DefaultAWSPartitionID = endpoints.AwsPartitionID + case endpoints.UsGovEast1RegionID, endpoints.UsGovWest1RegionID: + awsutil.DefaultAWSPartitionID = endpoints.AwsUsGovPartitionID + default: + if parsedConfig.CustomEndpoints.GetRegion(defaultRegion) == nil { + err = fmt.Errorf("the custom region '%s' must be specified in the configuration 'endpoints'", defaultRegion) + logrus.Error(err.Error()) + return err + } + } + } + + account, err := awsutil.NewAccount(creds, parsedConfig.CustomEndpoints) + if err != nil { + return err + } + + filters, err := parsedConfig.Filters(account.ID()) + if err != nil { + return err + } + + n := nuke.New(params, parsedConfig, filters, *account) + + n.RegisterValidateHandler(func() error { + return parsedConfig.ValidateAccount(n.Account.ID(), n.Account.Aliases()) + }) + + n.RegisterPrompt(n.Prompt) + + accountConfig := parsedConfig.Accounts[n.Account.ID()] + resourceTypes := nuke.ResolveResourceTypes( + resource.GetNames(), + nuke.GetCloudControlMapping(), + []types.Collection{ + n.Parameters.Targets, + n.Config.GetResourceTypes().Targets, + accountConfig.ResourceTypes.Targets, + }, + []types.Collection{ + n.Parameters.Excludes, + n.Config.GetResourceTypes().Excludes, + accountConfig.ResourceTypes.Excludes, + }, + []types.Collection{ + n.Parameters.CloudControl, + n.Config.GetResourceTypes().CloudControl, + accountConfig.ResourceTypes.CloudControl, + }, + ) + + // mutateOps is a function that will be called for each resource type to mutate the options + // for the scanner based on whatever criteria you want. However, in this case for the aws-nuke + // tool, it's mutating the opts to create the proper session for the proper region. + var mutateOps = func(opts interface{}, resourceType string) interface{} { + o := opts.(*nuke.ListerOpts) + + session, err := o.Region.Session(resourceType) + if err != nil { + panic(err) + } + + o.Session = session + return o + } + + for _, regionName := range parsedConfig.Regions { + region := nuke.NewRegion(regionName, n.Account.ResourceTypeToServiceType, n.Account.NewSession) + scanner := sdknuke.NewScanner(regionName, resourceTypes, &nuke.ListerOpts{ + Region: region, + }) + + regMutateErr := scanner.RegisterMutateOptsFunc(mutateOps) + if regMutateErr != nil { + return regMutateErr + } + + regScanErr := n.RegisterScanner(nuke.Account, scanner) + if regScanErr != nil { + return regScanErr + } + } + + return n.Run(ctx) +} + +func init() { + flags := []cli.Flag{ + &cli.PathFlag{ + Name: "config", + Usage: "path to config file", + Value: "config.yaml", + }, + &cli.BoolFlag{ + Name: "force", + Usage: "disable prompting for verification to run", + }, + &cli.IntFlag{ + Name: "force-sleep", + Usage: "seconds to sleep", + Value: 10, + }, + &cli.BoolFlag{ + Name: "quiet", + Usage: "hide filtered messages", + }, + &cli.BoolFlag{ + Name: "no-dry-run", + Usage: "actually run the removal of the resources after discovery", + }, + &cli.StringSliceFlag{ + Name: "only-resource", + Usage: "only run against these resource types", + Aliases: []string{"target"}, + }, + &cli.BoolFlag{ + Name: "experimental-deps", + Usage: "turn on dependency removal ordering", + }, + } + + cmd := &cli.Command{ + Name: "run", + Usage: "run nuke against an aws account and remove everything from it", + Aliases: []string{ + "nuke", + }, + Flags: append(flags, global.Flags()...), + Before: global.Before, + Action: execute, + } + + common.RegisterCommand(cmd) +} diff --git a/pkg/common/commands.go b/pkg/common/commands.go new file mode 100644 index 000000000..1f44bfbdc --- /dev/null +++ b/pkg/common/commands.go @@ -0,0 +1,24 @@ +package common + +import ( + "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" +) + +var commands []*cli.Command + +// Commander -- +type Commander interface { + Execute(c *cli.Context) +} + +// RegisterCommand -- +func RegisterCommand(command *cli.Command) { + logrus.Debugln("Registering", command.Name, "command...") + commands = append(commands, command) +} + +// GetCommands -- +func GetCommands() []*cli.Command { + return commands +} diff --git a/pkg/common/version.go b/pkg/common/version.go new file mode 100644 index 000000000..7323449ad --- /dev/null +++ b/pkg/common/version.go @@ -0,0 +1,32 @@ +package common + +// NAME of the App +var NAME = "aws-nuke" + +// SUMMARY of the Version +var SUMMARY = "3.0.0-beta.1" + +// BRANCH of the Version +var BRANCH = "dev" + +var COMMIT = "dirty" + +// AppVersion -- +var AppVersion AppVersionInfo + +// AppVersionInfo -- +type AppVersionInfo struct { + Name string + Branch string + Summary string + Commit string +} + +func init() { + AppVersion = AppVersionInfo{ + Name: NAME, + Branch: BRANCH, + Summary: SUMMARY, + Commit: COMMIT, + } +} diff --git a/pkg/config/config.go b/pkg/config/config.go index d87a1e8bb..bd531bd78 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -3,27 +3,29 @@ package config import ( "bytes" "fmt" - "io/ioutil" + "os" "strings" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + yaml "gopkg.in/yaml.v3" - log "github.com/sirupsen/logrus" - "gopkg.in/yaml.v3" + "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/filter" + "github.com/ekristen/libnuke/pkg/types" ) +type Account struct { + Filters filter.Filters `yaml:"filters"` + ResourceTypes ResourceTypes `yaml:"resource-types"` + Presets []string `yaml:"presets"` +} + type ResourceTypes struct { Targets types.Collection `yaml:"targets"` Excludes types.Collection `yaml:"excludes"` CloudControl types.Collection `yaml:"cloud-control"` } -type Account struct { - Filters Filters `yaml:"filters"` - ResourceTypes ResourceTypes `yaml:"resource-types"` - Presets []string `yaml:"presets"` -} - type Nuke struct { // Deprecated: Use AccountBlocklist instead. AccountBlacklist []string `yaml:"account-blacklist"` @@ -51,7 +53,7 @@ type DisableDeletionProtection struct { } type PresetDefinitions struct { - Filters Filters `yaml:"filters"` + Filters filter.Filters `yaml:"filters"` } type CustomService struct { @@ -73,24 +75,24 @@ type CustomEndpoints []*CustomRegion func Load(path string) (*Nuke, error) { var err error - raw, err := ioutil.ReadFile(path) + raw, err := os.ReadFile(path) if err != nil { return nil, err } - config := new(Nuke) + cfg := new(Nuke) dec := yaml.NewDecoder(bytes.NewReader(raw)) dec.KnownFields(true) - err = dec.Decode(&config) + err = dec.Decode(&cfg) if err != nil { return nil, err } - if err := config.resolveDeprecations(); err != nil { + if err := cfg.ResolveDeprecations(); err != nil { return nil, err } - return config, nil + return cfg, nil } func (c *Nuke) ResolveBlocklist() []string { @@ -98,7 +100,7 @@ func (c *Nuke) ResolveBlocklist() []string { return c.AccountBlocklist } - log.Warn("deprecated configuration key 'account-blacklist' - please use 'account-blocklist' instead") + logrus.Warn("deprecated configuration key 'account-blacklist' - please use 'account-blocklist' instead") return c.AccountBlacklist } @@ -117,6 +119,10 @@ func (c *Nuke) InBlocklist(searchID string) bool { return false } +func (c *Nuke) Validate(accountID string) error { + return nil +} + func (c *Nuke) ValidateAccount(accountID string, aliases []string) error { if !c.HasBlocklist() { return fmt.Errorf("The config file contains an empty blocklist. " + @@ -150,12 +156,12 @@ func (c *Nuke) ValidateAccount(accountID string, aliases []string) error { return nil } -func (c *Nuke) Filters(accountID string) (Filters, error) { +func (c *Nuke) Filters(accountID string) (filter.Filters, error) { account := c.Accounts[accountID] filters := account.Filters if filters == nil { - filters = Filters{} + filters = filter.Filters{} } if account.Presets == nil { @@ -163,7 +169,7 @@ func (c *Nuke) Filters(accountID string) (Filters, error) { } for _, presetName := range account.Presets { - notFound := fmt.Errorf("Could not find filter preset '%s'", presetName) + notFound := fmt.Errorf("could not find filter preset '%s'", presetName) if c.Presets == nil { return nil, notFound } @@ -179,7 +185,19 @@ func (c *Nuke) Filters(accountID string) (Filters, error) { return filters, nil } -func (c *Nuke) resolveDeprecations() error { +func (c *Nuke) GetFeatureFlags() FeatureFlags { + return c.FeatureFlags +} + +func (c *Nuke) GetPresets() map[string]PresetDefinitions { + return c.Presets +} + +func (c *Nuke) GetResourceTypes() ResourceTypes { + return c.ResourceTypes +} + +func (c *Nuke) ResolveDeprecations() error { deprecations := map[string]string{ "EC2DhcpOptions": "EC2DHCPOptions", "EC2InternetGatewayAttachement": "EC2InternetGatewayAttachment", @@ -203,6 +221,9 @@ func (c *Nuke) resolveDeprecations() error { "IamUserGroupAttachement": "IAMUserGroupAttachment", "IamUserPolicyAttachement": "IAMUserPolicyAttachment", "RDSCluster": "RDSDBCluster", + "EKSFargateProfiles": "EKSFargateProfile", + "EKSNodegroups": "EKSNodegroup", + "NetpuneSnapshot": "NeptuneSnapshot", } for _, a := range c.Accounts { @@ -211,7 +232,7 @@ func (c *Nuke) resolveDeprecations() error { if !ok { continue } - log.Warnf("deprecated resource type '%s' - converting to '%s'\n", resourceType, replacement) + logrus.Warnf("deprecated resource type '%s' - converting to '%s'\n", resourceType, replacement) if _, ok := a.Filters[replacement]; ok { return fmt.Errorf("using deprecated resource type and replacement: '%s','%s'", resourceType, replacement) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index ad355559a..ce5358486 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -2,11 +2,11 @@ package config import ( "fmt" + "github.com/ekristen/libnuke/pkg/filter" + "github.com/ekristen/libnuke/pkg/types" "reflect" "strings" "testing" - - "github.com/rebuy-de/aws-nuke/v2/pkg/types" ) func TestConfigBlocklist(t *testing.T) { @@ -46,7 +46,7 @@ func TestConfigBlocklist(t *testing.T) { } func TestLoadExampleConfig(t *testing.T) { - config, err := Load("test-fixtures/example.yaml") + config, err := Load("testdata/example.yaml") if err != nil { t.Fatal(err) } @@ -57,12 +57,12 @@ func TestLoadExampleConfig(t *testing.T) { Accounts: map[string]Account{ "555133742": { Presets: []string{"terraform"}, - Filters: Filters{ + Filters: filter.Filters{ "IAMRole": { - NewExactFilter("uber.admin"), + filter.NewExactFilter("uber.admin"), }, "IAMRolePolicyAttachment": { - NewExactFilter("uber.admin -> AdministratorAccess"), + filter.NewExactFilter("uber.admin -> AdministratorAccess"), }, }, ResourceTypes: ResourceTypes{ @@ -76,10 +76,10 @@ func TestLoadExampleConfig(t *testing.T) { }, Presets: map[string]PresetDefinitions{ "terraform": { - Filters: Filters{ + Filters: filter.Filters{ "S3Bucket": { - Filter{ - Type: FilterTypeGlob, + filter.Filter{ + Type: filter.Glob, Value: "my-statebucket-*", }, }, @@ -118,24 +118,24 @@ func TestResolveDeprecations(t *testing.T) { Regions: []string{"eu-west-1"}, Accounts: map[string]Account{ "555133742": { - Filters: Filters{ + Filters: filter.Filters{ "IamRole": { - NewExactFilter("uber.admin"), - NewExactFilter("foo.bar"), + filter.NewExactFilter("uber.admin"), + filter.NewExactFilter("foo.bar"), }, "IAMRolePolicyAttachment": { - NewExactFilter("uber.admin -> AdministratorAccess"), + filter.NewExactFilter("uber.admin -> AdministratorAccess"), }, }, }, "2345678901": { - Filters: Filters{ + Filters: filter.Filters{ "ECRrepository": { - NewExactFilter("foo:bar"), - NewExactFilter("bar:foo"), + filter.NewExactFilter("foo:bar"), + filter.NewExactFilter("bar:foo"), }, "IAMRolePolicyAttachment": { - NewExactFilter("uber.admin -> AdministratorAccess"), + filter.NewExactFilter("uber.admin -> AdministratorAccess"), }, }, }, @@ -144,30 +144,30 @@ func TestResolveDeprecations(t *testing.T) { expect := map[string]Account{ "555133742": { - Filters: Filters{ + Filters: filter.Filters{ "IAMRole": { - NewExactFilter("uber.admin"), - NewExactFilter("foo.bar"), + filter.NewExactFilter("uber.admin"), + filter.NewExactFilter("foo.bar"), }, "IAMRolePolicyAttachment": { - NewExactFilter("uber.admin -> AdministratorAccess"), + filter.NewExactFilter("uber.admin -> AdministratorAccess"), }, }, }, "2345678901": { - Filters: Filters{ + Filters: filter.Filters{ "ECRRepository": { - NewExactFilter("foo:bar"), - NewExactFilter("bar:foo"), + filter.NewExactFilter("foo:bar"), + filter.NewExactFilter("bar:foo"), }, "IAMRolePolicyAttachment": { - NewExactFilter("uber.admin -> AdministratorAccess"), + filter.NewExactFilter("uber.admin -> AdministratorAccess"), }, }, }, } - err := config.resolveDeprecations() + err := config.ResolveDeprecations() if err != nil { t.Fatal(err) } @@ -182,24 +182,24 @@ func TestResolveDeprecations(t *testing.T) { Regions: []string{"eu-west-1"}, Accounts: map[string]Account{ "555133742": { - Filters: Filters{ + Filters: filter.Filters{ "IamUserAccessKeys": { - NewExactFilter("X")}, + filter.NewExactFilter("X")}, "IAMUserAccessKey": { - NewExactFilter("Y")}, + filter.NewExactFilter("Y")}, }, }, }, } - err = invalidConfig.resolveDeprecations() + err = invalidConfig.ResolveDeprecations() if err == nil || !strings.Contains(err.Error(), "using deprecated resource type and replacement") { t.Fatal("invalid config did not cause correct error") } } func TestConfigValidation(t *testing.T) { - config, err := Load("test-fixtures/example.yaml") + config, err := Load("testdata/example.yaml") if err != nil { t.Fatal(err) } @@ -232,7 +232,7 @@ func TestConfigValidation(t *testing.T) { } func TestDeprecatedConfigKeys(t *testing.T) { - config, err := Load("test-fixtures/deprecated-keys-config.yaml") + config, err := Load("testdata/deprecated-keys-config.yaml") if err != nil { t.Fatal(err) } @@ -243,7 +243,7 @@ func TestDeprecatedConfigKeys(t *testing.T) { } func TestFilterMerge(t *testing.T) { - config, err := Load("test-fixtures/example.yaml") + config, err := Load("testdata/example.yaml") if err != nil { t.Fatal(err) } @@ -253,19 +253,19 @@ func TestFilterMerge(t *testing.T) { t.Fatal(err) } - expect := Filters{ - "S3Bucket": []Filter{ + expect := filter.Filters{ + "S3Bucket": []filter.Filter{ { Type: "glob", Value: "my-statebucket-*", }, }, - "IAMRole": []Filter{ + "IAMRole": []filter.Filter{ { Type: "exact", Value: "uber.admin", }, }, - "IAMRolePolicyAttachment": []Filter{ + "IAMRolePolicyAttachment": []filter.Filter{ { Type: "exact", Value: "uber.admin -> AdministratorAccess", @@ -281,7 +281,7 @@ func TestFilterMerge(t *testing.T) { } func TestGetCustomRegion(t *testing.T) { - config, err := Load("test-fixtures/example.yaml") + config, err := Load("testdata/example.yaml") if err != nil { t.Fatal(err) } @@ -303,6 +303,5 @@ func TestGetCustomRegion(t *testing.T) { if rdsService != nil { t.Fatal("Expected to not find a custom rds service for region10") } - }) } diff --git a/pkg/config/filter.go b/pkg/config/filter.go deleted file mode 100644 index 61fcbef00..000000000 --- a/pkg/config/filter.go +++ /dev/null @@ -1,130 +0,0 @@ -package config - -import ( - "fmt" - "regexp" - "strconv" - "strings" - "time" - - "github.com/mb0/glob" -) - -type FilterType string - -const ( - FilterTypeEmpty FilterType = "" - FilterTypeExact = "exact" - FilterTypeGlob = "glob" - FilterTypeRegex = "regex" - FilterTypeContains = "contains" - FilterTypeDateOlderThan = "dateOlderThan" -) - -type Filters map[string][]Filter - -func (f Filters) Merge(f2 Filters) { - for resourceType, filter := range f2 { - f[resourceType] = append(f[resourceType], filter...) - } -} - -type Filter struct { - Property string - Type FilterType - Value string - Invert string -} - -func (f Filter) Match(o string) (bool, error) { - switch f.Type { - case FilterTypeEmpty: - fallthrough - - case FilterTypeExact: - return f.Value == o, nil - - case FilterTypeContains: - return strings.Contains(o, f.Value), nil - - case FilterTypeGlob: - return glob.Match(f.Value, o) - - case FilterTypeRegex: - re, err := regexp.Compile(f.Value) - if err != nil { - return false, err - } - return re.MatchString(o), nil - - case FilterTypeDateOlderThan: - if o == "" { - return false, nil - } - duration, err := time.ParseDuration(f.Value) - if err != nil { - return false, err - } - fieldTime, err := parseDate(o) - if err != nil { - return false, err - } - fieldTimeWithOffset := fieldTime.Add(duration) - - return fieldTimeWithOffset.After(time.Now()), nil - - default: - return false, fmt.Errorf("unknown type %s", f.Type) - } -} - -func parseDate(input string) (time.Time, error) { - if i, err := strconv.ParseInt(input, 10, 64); err == nil { - t := time.Unix(i, 0) - return t, nil - } - - formats := []string{"2006-01-02", - "2006/01/02", - "2006-01-02T15:04:05Z", - "2006-01-02 15:04:05.000 -0700 MST", // Date format used by AWS for CreateTime on ASGs - time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON() - time.RFC3339, - } - for _, f := range formats { - t, err := time.Parse(f, input) - if err == nil { - return t, nil - } - } - return time.Now(), fmt.Errorf("unable to parse time %s", input) -} - -func (f *Filter) UnmarshalYAML(unmarshal func(interface{}) error) error { - var value string - - if unmarshal(&value) == nil { - f.Type = FilterTypeExact - f.Value = value - return nil - } - - m := map[string]string{} - err := unmarshal(m) - if err != nil { - return err - } - - f.Type = FilterType(m["type"]) - f.Value = m["value"] - f.Property = m["property"] - f.Invert = m["invert"] - return nil -} - -func NewExactFilter(value string) Filter { - return Filter{ - Type: FilterTypeExact, - Value: value, - } -} diff --git a/pkg/config/filter_test.go b/pkg/config/filter_test.go deleted file mode 100644 index a26df88c7..000000000 --- a/pkg/config/filter_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package config_test - -import ( - "strconv" - "testing" - "time" - - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - yaml "gopkg.in/yaml.v3" -) - -func TestUnmarshalFilter(t *testing.T) { - past := time.Now().UTC().Add(-24 * time.Hour) - future := time.Now().UTC().Add(24 * time.Hour) - cases := []struct { - yaml string - match, mismatch []string - }{ - { - yaml: `foo`, - match: []string{"foo"}, - mismatch: []string{"fo", "fooo", "o", "fo"}, - }, - { - yaml: `{"type":"exact","value":"foo"}`, - match: []string{"foo"}, - mismatch: []string{"fo", "fooo", "o", "fo"}, - }, - { - yaml: `{"type":"glob","value":"b*sh"}`, - match: []string{"bish", "bash", "bosh", "bush", "boooooosh", "bsh"}, - mismatch: []string{"woooosh", "fooo", "o", "fo"}, - }, - { - yaml: `{"type":"glob","value":"b?sh"}`, - match: []string{"bish", "bash", "bosh", "bush"}, - mismatch: []string{"woooosh", "fooo", "o", "fo", "boooooosh", "bsh"}, - }, - { - yaml: `{"type":"regex","value":"b[iao]sh"}`, - match: []string{"bish", "bash", "bosh"}, - mismatch: []string{"woooosh", "fooo", "o", "fo", "boooooosh", "bsh", "bush"}, - }, - { - yaml: `{"type":"contains","value":"mba"}`, - match: []string{"bimbaz", "mba", "bi mba z"}, - mismatch: []string{"bim-baz"}, - }, - { - yaml: `{"type":"dateOlderThan","value":"0"}`, - match: []string{strconv.Itoa(int(future.Unix())), - future.Format("2006-01-02"), - future.Format("2006/01/02"), - future.Format("2006-01-02T15:04:05Z"), - future.Format(time.RFC3339Nano), - future.Format(time.RFC3339), - }, - mismatch: []string{"", - strconv.Itoa(int(past.Unix())), - past.Format("2006-01-02"), - past.Format("2006/01/02"), - past.Format("2006-01-02T15:04:05Z"), - past.Format(time.RFC3339Nano), - past.Format(time.RFC3339), - }, - }, - } - - for _, tc := range cases { - t.Run(tc.yaml, func(t *testing.T) { - var filter config.Filter - - err := yaml.Unmarshal([]byte(tc.yaml), &filter) - if err != nil { - t.Fatal(err) - } - - for _, o := range tc.match { - match, err := filter.Match(o) - if err != nil { - t.Fatal(err) - } - - if !match { - t.Fatalf("'%v' should match", o) - } - } - - for _, o := range tc.mismatch { - match, err := filter.Match(o) - if err != nil { - t.Fatal(err) - } - - if match { - t.Fatalf("'%v' should not match", o) - } - } - }) - } - -} diff --git a/pkg/config/test-fixtures/deprecated-keys-config.yaml b/pkg/config/test-fixtures/deprecated-keys-config.yaml deleted file mode 100644 index 17e39f1f5..000000000 --- a/pkg/config/test-fixtures/deprecated-keys-config.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -account-blacklist: - - 1234567890 \ No newline at end of file diff --git a/pkg/config/test-fixtures/example.yaml b/pkg/config/test-fixtures/example.yaml deleted file mode 100644 index f5ca65f3f..000000000 --- a/pkg/config/test-fixtures/example.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -regions: -- "eu-west-1" -- stratoscale - -account-blocklist: -- 1234567890 - -endpoints: -- region: stratoscale - tls_insecure_skip_verify: true - services: - - service: ec2 - url: https://stratoscale.cloud.internal/api/v2/aws/ec2 - - service: s3 - url: https://stratoscale.cloud.internal:1060 - tls_insecure_skip_verify: true - -resource-types: - targets: - - DynamoDBTable - - S3Bucket - - S3Object - excludes: - - IAMRole - -accounts: - 555133742: - presets: - - "terraform" - resource-types: - targets: - - S3Bucket - filters: - IAMRole: - - "uber.admin" - IAMRolePolicyAttachment: - - "uber.admin -> AdministratorAccess" - -presets: - terraform: - filters: - S3Bucket: - - type: glob - value: "my-statebucket-*" diff --git a/pkg/config/testdata/deprecated-keys-config.yaml b/pkg/config/testdata/deprecated-keys-config.yaml new file mode 100644 index 000000000..55ac8b570 --- /dev/null +++ b/pkg/config/testdata/deprecated-keys-config.yaml @@ -0,0 +1,3 @@ +--- +account-blocklist: + - 1234567890 diff --git a/pkg/config/testdata/example.yaml b/pkg/config/testdata/example.yaml new file mode 100644 index 000000000..777250c4c --- /dev/null +++ b/pkg/config/testdata/example.yaml @@ -0,0 +1,45 @@ +--- +regions: + - "eu-west-1" + - stratoscale + +account-blocklist: + - 1234567890 + +endpoints: + - region: stratoscale + tls_insecure_skip_verify: true + services: + - service: ec2 + url: https://stratoscale.cloud.internal/api/v2/aws/ec2 + - service: s3 + url: https://stratoscale.cloud.internal:1060 + tls_insecure_skip_verify: true + +resource-types: + targets: + - DynamoDBTable + - S3Bucket + - S3Object + excludes: + - IAMRole + +accounts: + 555133742: + presets: + - "terraform" + resource-types: + targets: + - S3Bucket + filters: + IAMRole: + - "uber.admin" + IAMRolePolicyAttachment: + - "uber.admin -> AdministratorAccess" + +presets: + terraform: + filters: + S3Bucket: + - type: glob + value: "my-statebucket-*" \ No newline at end of file diff --git a/pkg/nuke/cloudcontrol.go b/pkg/nuke/cloudcontrol.go new file mode 100644 index 000000000..6d953339c --- /dev/null +++ b/pkg/nuke/cloudcontrol.go @@ -0,0 +1,23 @@ +package nuke + +import ( + "fmt" + "github.com/ekristen/libnuke/pkg/resource" +) + +var cloudControlMapping = map[string]string{} + +func GetCloudControlMapping() map[string]string { + return cloudControlMapping +} + +func MapCloudControl(typeName string) resource.RegisterOption { + return func(name string, lister resource.Lister) { + _, exists := cloudControlMapping[typeName] + if exists { + panic(fmt.Sprintf("a cloud control mapping for %s already exists", typeName)) + } + + cloudControlMapping[typeName] = name + } +} diff --git a/pkg/nuke/nuke.go b/pkg/nuke/nuke.go new file mode 100644 index 000000000..ad3498f45 --- /dev/null +++ b/pkg/nuke/nuke.go @@ -0,0 +1,69 @@ +package nuke + +import ( + "fmt" + "github.com/ekristen/aws-nuke/pkg/awsutil" + "github.com/ekristen/aws-nuke/pkg/config" + "github.com/ekristen/libnuke/pkg/featureflag" + "github.com/ekristen/libnuke/pkg/filter" + sdknuke "github.com/ekristen/libnuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/utils" + "github.com/sirupsen/logrus" + "time" +) + +type Parameters struct { + sdknuke.Parameters + + Targets []string + Excludes []string + CloudControl []string +} + +type Nuke struct { + *sdknuke.Nuke + Parameters Parameters + Config *config.Nuke + Account awsutil.Account +} + +func (n *Nuke) Prompt() error { + forceSleep := time.Duration(n.Parameters.ForceSleep) * time.Second + + fmt.Printf("Do you really want to nuke the account with "+ + "the ID %s and the alias '%s'?\n", n.Account.ID(), n.Account.Alias()) + if n.Parameters.Force { + fmt.Printf("Waiting %v before continuing.\n", forceSleep) + time.Sleep(forceSleep) + } else { + fmt.Printf("Do you want to continue? Enter account alias to continue.\n") + if err := utils.Prompt(n.Account.Alias()); err != nil { + return err + } + } + + return nil +} + +func New(params Parameters, config *config.Nuke, filters filter.Filters, account awsutil.Account) *Nuke { + n := Nuke{ + Nuke: sdknuke.New(params.Parameters, filters), + Parameters: params, + Config: config, + Account: account, + } + + n.SetLogger(logrus.WithField("component", "nuke")) + + defaultValue := featureflag.Bool(false) + + n.RegisterFeatureFlags("DisableEC2InstanceStopProtection", defaultValue, featureflag.Bool(config.FeatureFlags.DisableEC2InstanceStopProtection)) + n.RegisterFeatureFlags("ForceDeleteLightsailAddOns", defaultValue, featureflag.Bool(config.FeatureFlags.ForceDeleteLightsailAddOns)) + n.RegisterFeatureFlags("DisableDeletionProtection_RDSInstance", defaultValue, featureflag.Bool(config.FeatureFlags.DisableDeletionProtection.RDSInstance)) + n.RegisterFeatureFlags("DisableDeletionProtection_EC2Instance", defaultValue, featureflag.Bool(config.FeatureFlags.DisableDeletionProtection.EC2Instance)) + n.RegisterFeatureFlags("DisableDeletionProtection_ELBv2", defaultValue, featureflag.Bool(config.FeatureFlags.DisableDeletionProtection.ELBv2)) + n.RegisterFeatureFlags("DisableDeletionProtection_CloudformationStack", defaultValue, featureflag.Bool(config.FeatureFlags.DisableDeletionProtection.CloudformationStack)) + n.RegisterFeatureFlags("DisableDeletionProtection_QLDBLedger", defaultValue, featureflag.Bool(config.FeatureFlags.DisableDeletionProtection.QLDBLedger)) + + return &n +} diff --git a/cmd/region.go b/pkg/nuke/region.go similarity index 92% rename from cmd/region.go rename to pkg/nuke/region.go index adf5f58dc..cd4fc20d2 100644 --- a/cmd/region.go +++ b/pkg/nuke/region.go @@ -1,11 +1,11 @@ -package cmd +package nuke import ( "fmt" + sdkerrors "github.com/ekristen/libnuke/pkg/errors" "sync" "github.com/aws/aws-sdk-go/aws/session" - "github.com/rebuy-de/aws-nuke/v2/pkg/awsutil" ) // SessionFactory support for custom endpoints @@ -36,7 +36,7 @@ func NewRegion(name string, typeResolver ResourceTypeResolver, sessionFactory Se func (region *Region) Session(resourceType string) (*session.Session, error) { svcType := region.ResTypeResolver(region.Name, resourceType) if svcType == "" { - return nil, awsutil.ErrSkipRequest(fmt.Sprintf( + return nil, sdkerrors.ErrSkipRequest(fmt.Sprintf( "No service available in region '%s' to handle '%s'", region.Name, resourceType)) } diff --git a/pkg/nuke/resource.go b/pkg/nuke/resource.go new file mode 100644 index 000000000..e55bbfbfd --- /dev/null +++ b/pkg/nuke/resource.go @@ -0,0 +1,27 @@ +package nuke + +import ( + "github.com/aws/aws-sdk-go/aws/session" + "github.com/ekristen/libnuke/pkg/resource" +) + +const ( + Account resource.Scope = "account" +) + +type ListerOpts struct { + Region *Region + Session *session.Session +} + +func (o ListerOpts) ID() string { + return "" +} + +type Lister struct { + opts ListerOpts +} + +func (l *Lister) SetOptions(opts interface{}) { + l.opts = opts.(ListerOpts) +} diff --git a/cmd/util.go b/pkg/nuke/utils.go similarity index 50% rename from cmd/util.go rename to pkg/nuke/utils.go index 868e7f04f..a27253b85 100644 --- a/cmd/util.go +++ b/pkg/nuke/utils.go @@ -1,34 +1,13 @@ -package cmd +package nuke import ( - "bufio" - "fmt" - "os" - "strings" - - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "github.com/ekristen/libnuke/pkg/types" ) -func Prompt(expect string) error { - fmt.Print("> ") - reader := bufio.NewReader(os.Stdin) - text, err := reader.ReadString('\n') - if err != nil { - return err - } - - if strings.TrimSpace(text) != expect { - return fmt.Errorf("aborted") - } - fmt.Println() - - return nil -} - func ResolveResourceTypes( - base types.Collection, mapping map[string]string, + base types.Collection, + mapping map[string]string, include, exclude, cloudControl []types.Collection) types.Collection { - for _, cl := range cloudControl { oldStyle := types.Collection{} for _, c := range cl { @@ -54,7 +33,3 @@ func ResolveResourceTypes( return base } - -func IsTrue(s string) bool { - return strings.TrimSpace(strings.ToLower(s)) == "true" -} diff --git a/pkg/types/collection.go b/pkg/types/collection.go deleted file mode 100644 index 408a696b6..000000000 --- a/pkg/types/collection.go +++ /dev/null @@ -1,50 +0,0 @@ -package types - -type Collection []string - -func (c Collection) Intersect(o Collection) Collection { - mo := o.toMap() - - result := Collection{} - for _, t := range c { - if mo[t] { - result = append(result, t) - } - } - - return result -} - -func (c Collection) Remove(o Collection) Collection { - mo := o.toMap() - - result := Collection{} - for _, t := range c { - if !mo[t] { - result = append(result, t) - } - } - - return result -} - -func (c Collection) Union(o Collection) Collection { - ms := c.toMap() - - result := []string(c) - for _, oi := range o { - if !ms[oi] { - result = append(result, oi) - } - } - - return Collection(result) -} - -func (c Collection) toMap() map[string]bool { - m := map[string]bool{} - for _, t := range c { - m[t] = true - } - return m -} diff --git a/pkg/types/collection_test.go b/pkg/types/collection_test.go deleted file mode 100644 index 72f3882b9..000000000 --- a/pkg/types/collection_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package types_test - -import ( - "fmt" - "testing" - - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) - -func TestSetInterset(t *testing.T) { - s1 := types.Collection{"a", "b", "c"} - s2 := types.Collection{"b", "a", "d"} - - r := s1.Intersect(s2) - - want := fmt.Sprint([]string{"a", "b"}) - have := fmt.Sprint(r) - - if want != have { - t.Errorf("Wrong result. Want: %s. Have: %s", want, have) - } -} - -func TestSetRemove(t *testing.T) { - s1 := types.Collection{"a", "b", "c"} - s2 := types.Collection{"b", "a", "d"} - - r := s1.Remove(s2) - - want := fmt.Sprint([]string{"c"}) - have := fmt.Sprint(r) - - if want != have { - t.Errorf("Wrong result. Want: %s. Have: %s", want, have) - } -} - -func TestSetUnion(t *testing.T) { - s1 := types.Collection{"a", "b", "c"} - s2 := types.Collection{"b", "a", "d"} - - r := s1.Union(s2) - - want := fmt.Sprint([]string{"a", "b", "c", "d"}) - have := fmt.Sprint(r) - - if want != have { - t.Errorf("Wrong result. Want: %s. Have: %s", want, have) - } -} diff --git a/pkg/types/properties.go b/pkg/types/properties.go deleted file mode 100644 index 5789669b5..000000000 --- a/pkg/types/properties.go +++ /dev/null @@ -1,122 +0,0 @@ -package types - -import ( - "fmt" - "sort" - "strings" -) - -type Properties map[string]string - -func NewProperties() Properties { - return make(Properties) -} - -func (p Properties) String() string { - parts := []string{} - for k, v := range p { - parts = append(parts, fmt.Sprintf(`%s: "%v"`, k, v)) - } - - sort.Strings(parts) - - return fmt.Sprintf("[%s]", strings.Join(parts, ", ")) -} - -func (p Properties) Set(key string, value interface{}) Properties { - if value == nil { - return p - } - - switch v := value.(type) { - case *string: - if v == nil { - return p - } - p[key] = *v - case []byte: - p[key] = string(v) - case *bool: - if v == nil { - return p - } - p[key] = fmt.Sprint(*v) - case *int64: - if v == nil { - return p - } - p[key] = fmt.Sprint(*v) - case *int: - if v == nil { - return p - } - p[key] = fmt.Sprint(*v) - default: - // Fallback to Stringer interface. This produces gibberish on pointers, - // but is the only way to avoid reflection. - p[key] = fmt.Sprint(value) - } - - return p -} - -func (p Properties) SetTag(tagKey *string, tagValue interface{}) Properties { - return p.SetTagWithPrefix("", tagKey, tagValue) -} - -func (p Properties) SetTagWithPrefix(prefix string, tagKey *string, tagValue interface{}) Properties { - if tagKey == nil { - return p - } - - keyStr := strings.TrimSpace(*tagKey) - prefix = strings.TrimSpace(prefix) - - if keyStr == "" { - return p - } - - if prefix != "" { - keyStr = fmt.Sprintf("%s:%s", prefix, keyStr) - } - - keyStr = fmt.Sprintf("tag:%s", keyStr) - - return p.Set(keyStr, tagValue) -} - -func (p Properties) Get(key string) string { - value, ok := p[key] - if !ok { - return "" - } - - return value -} - -func (p Properties) Equals(o Properties) bool { - if p == nil && o == nil { - return true - } - - if p == nil || o == nil { - return false - } - - if len(p) != len(o) { - return false - } - - for k, pv := range p { - ov, ok := o[k] - if !ok { - return false - } - - if pv != ov { - return false - } - } - - return true -} diff --git a/pkg/types/properties_test.go b/pkg/types/properties_test.go deleted file mode 100644 index 79481099a..000000000 --- a/pkg/types/properties_test.go +++ /dev/null @@ -1,163 +0,0 @@ -package types_test - -import ( - "fmt" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) - -func TestPropertiesEquals(t *testing.T) { - cases := []struct { - p1, p2 types.Properties - result bool - }{ - { - p1: nil, - p2: nil, - result: true, - }, - { - p1: nil, - p2: types.NewProperties(), - result: false, - }, - { - p1: types.NewProperties(), - p2: types.NewProperties(), - result: true, - }, - { - p1: types.NewProperties().Set("blub", "blubber"), - p2: types.NewProperties().Set("blub", "blubber"), - result: true, - }, - { - p1: types.NewProperties().Set("blub", "foo"), - p2: types.NewProperties().Set("blub", "bar"), - result: false, - }, - { - p1: types.NewProperties().Set("bim", "baz").Set("blub", "blubber"), - p2: types.NewProperties().Set("bim", "baz").Set("blub", "blubber"), - result: true, - }, - { - p1: types.NewProperties().Set("bim", "baz").Set("blub", "foo"), - p2: types.NewProperties().Set("bim", "baz").Set("blub", "bar"), - result: false, - }, - } - - for i, tc := range cases { - t.Run(fmt.Sprint(i), func(t *testing.T) { - if tc.p1.Equals(tc.p2) != tc.result { - t.Errorf("Test Case failed. Want %t. Got %t.", !tc.result, tc.result) - t.Errorf("p1: %s", tc.p1.String()) - t.Errorf("p2: %s", tc.p2.String()) - } else if tc.p2.Equals(tc.p1) != tc.result { - t.Errorf("Test Case reverse check failed. Want %t. Got %t.", !tc.result, tc.result) - t.Errorf("p1: %s", tc.p1.String()) - t.Errorf("p2: %s", tc.p2.String()) - } - }) - } -} - -func TestPropertiesSetTag(t *testing.T) { - cases := []struct { - name string - key *string - value interface{} - want string - }{ - { - name: "string", - key: aws.String("name"), - value: "blubber", - want: `[tag:name: "blubber"]`, - }, - { - name: "string_ptr", - key: aws.String("name"), - value: aws.String("blubber"), - want: `[tag:name: "blubber"]`, - }, - { - name: "int", - key: aws.String("int"), - value: 42, - want: `[tag:int: "42"]`, - }, - { - name: "nil", - key: aws.String("nothing"), - value: nil, - want: `[]`, - }, - { - name: "empty_key", - key: aws.String(""), - value: "empty", - want: `[]`, - }, - { - name: "nil_key", - key: nil, - value: "empty", - want: `[]`, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - p := types.NewProperties() - - p.SetTag(tc.key, tc.value) - have := p.String() - - if tc.want != have { - t.Errorf("'%s' != '%s'", tc.want, have) - } - }) - } -} - -func TestPropertiesSetTagWithPrefix(t *testing.T) { - cases := []struct { - name string - prefix string - key *string - value interface{} - want string - }{ - { - name: "empty", - prefix: "", - key: aws.String("name"), - value: "blubber", - want: `[tag:name: "blubber"]`, - }, - { - name: "nonempty", - prefix: "bish", - key: aws.String("bash"), - value: "bosh", - want: `[tag:bish:bash: "bosh"]`, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - p := types.NewProperties() - - p.SetTagWithPrefix(tc.prefix, tc.key, tc.value) - have := p.String() - - if tc.want != have { - t.Errorf("'%s' != '%s'", tc.want, have) - } - }) - } -} diff --git a/pkg/util/indent.go b/pkg/util/indent.go deleted file mode 100644 index 2a09e5352..000000000 --- a/pkg/util/indent.go +++ /dev/null @@ -1,18 +0,0 @@ -package util - -func Indent(s, prefix string) string { - return string(IndentBytes([]byte(s), []byte(prefix))) -} - -func IndentBytes(b, prefix []byte) []byte { - var res []byte - bol := true - for _, c := range b { - if bol && c != '\n' { - res = append(res, prefix...) - } - res = append(res, c) - bol = c == '\n' - } - return res -} diff --git a/pkg/util/unique_id.go b/pkg/util/unique_id.go deleted file mode 100644 index bb79863c4..000000000 --- a/pkg/util/unique_id.go +++ /dev/null @@ -1,25 +0,0 @@ -package util - -import ( - "bytes" - "math/rand" - "time" -) - -// Returns a unique (ish) id we can attach to resources and tfstate files so they don't conflict with each other -// Uses base 62 to generate a 6 character string that's unlikely to collide with the handful of tests we run in -// parallel. Based on code here: http://stackoverflow.com/a/9543797/483528 -func UniqueID() string { - - const BASE_62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - const UNIQUE_ID_LENGTH = 6 // Should be good for 62^6 = 56+ billion combinations - - var out bytes.Buffer - - rand := rand.New(rand.NewSource(time.Now().UnixNano())) - for i := 0; i < UNIQUE_ID_LENGTH; i++ { - out.WriteByte(BASE_62_CHARS[rand.Intn(len(BASE_62_CHARS))]) - } - - return out.String() -} diff --git a/resources/accessanalyzer-analyzers.go b/resources/accessanalyzer-analyzers.go index e1f957d7c..9162cb241 100644 --- a/resources/accessanalyzer-analyzers.go +++ b/resources/accessanalyzer-analyzers.go @@ -1,12 +1,19 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/accessanalyzer" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const AccessAnalyzerResource = "AccessAnalyzer" + type AccessAnalyzer struct { svc *accessanalyzer.AccessAnalyzer arn string @@ -16,19 +23,25 @@ type AccessAnalyzer struct { } func init() { - register("AccessAnalyzer", ListAccessAnalyzer, - mapCloudControl("AWS::AccessAnalyzer::Analyzer")) + resource.Register(resource.Registration{ + Name: AccessAnalyzerResource, + Scope: nuke.Account, + Lister: &AccessAnalyzerLister{}, + }, nuke.MapCloudControl("AWS::AccessAnalyzer::Analyzer")) } -func ListAccessAnalyzer(sess *session.Session) ([]Resource, error) { - svc := accessanalyzer.New(sess) +type AccessAnalyzerLister struct{} + +func (l *AccessAnalyzerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := accessanalyzer.New(opts.Session) params := &accessanalyzer.ListAnalyzersInput{ Type: aws.String("ACCOUNT"), } - resources := make([]Resource, 0) - err := svc.ListAnalyzersPages(params, + resources := make([]resource.Resource, 0) + if err := svc.ListAnalyzersPages(params, func(page *accessanalyzer.ListAnalyzersOutput, lastPage bool) bool { for _, analyzer := range page.Analyzers { resources = append(resources, &AccessAnalyzer{ @@ -40,15 +53,14 @@ func ListAccessAnalyzer(sess *session.Session) ([]Resource, error) { }) } return true - }) - if err != nil { + }); err != nil { return nil, err } return resources, nil } -func (a *AccessAnalyzer) Remove() error { +func (a *AccessAnalyzer) Remove(_ context.Context) error { _, err := a.svc.DeleteAnalyzer(&accessanalyzer.DeleteAnalyzerInput{AnalyzerName: &a.name}) return err diff --git a/resources/accessanalyzer-archiverules.go b/resources/accessanalyzer-archiverules.go index 0ffa81284..4a86f253d 100644 --- a/resources/accessanalyzer-archiverules.go +++ b/resources/accessanalyzer-archiverules.go @@ -1,30 +1,70 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/accessanalyzer" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const AccessAnalyzerArchiveRuleResource = "ArchiveRule" + +func init() { + resource.Register(resource.Registration{ + Name: AccessAnalyzerArchiveRuleResource, + Scope: nuke.Account, + Lister: &AccessAnalyzerArchiveRuleLister{}, + }) +} + type ArchiveRule struct { svc *accessanalyzer.AccessAnalyzer ruleName string analyzerName string } -func init() { - register("ArchiveRule", ListArchiveRule) +func (a *ArchiveRule) Remove(_ context.Context) error { + _, err := a.svc.DeleteArchiveRule(&accessanalyzer.DeleteArchiveRuleInput{ + AnalyzerName: &a.analyzerName, + RuleName: &a.ruleName, + }) + + return err +} + +func (a *ArchiveRule) Properties() types.Properties { + properties := types.NewProperties() + + properties.Set("RuleName", a.ruleName) + properties.Set("AnalyzerName", a.analyzerName) + + return properties +} + +func (a *ArchiveRule) String() string { + return a.ruleName } -func ListArchiveRule(sess *session.Session) ([]Resource, error) { - svc := accessanalyzer.New(sess) +// --------------------------- + +type AccessAnalyzerArchiveRuleLister struct{} + +func (l *AccessAnalyzerArchiveRuleLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - analyzers, err := ListAccessAnalyzer(sess) + svc := accessanalyzer.New(opts.Session) + + lister := &AccessAnalyzerLister{} + analyzers, err := lister.List(ctx, o) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, analyzer := range analyzers { a, ok := analyzer.(*AccessAnalyzer) @@ -54,25 +94,3 @@ func ListArchiveRule(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (a *ArchiveRule) Remove() error { - _, err := a.svc.DeleteArchiveRule(&accessanalyzer.DeleteArchiveRuleInput{ - AnalyzerName: &a.analyzerName, - RuleName: &a.ruleName, - }) - - return err -} - -func (a *ArchiveRule) Properties() types.Properties { - properties := types.NewProperties() - - properties.Set("RuleName", a.ruleName) - properties.Set("AnalyzerName", a.analyzerName) - - return properties -} - -func (a *ArchiveRule) String() string { - return a.ruleName -} diff --git a/resources/acm-certificates.go b/resources/acm-certificates.go index 4a8d7bb22..0ee0da172 100644 --- a/resources/acm-certificates.go +++ b/resources/acm-certificates.go @@ -1,26 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/acm" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ACMCertificate struct { - svc *acm.ACM - certificateARN *string - certificateDetail *acm.CertificateDetail - tags []*acm.Tag -} +const ACMCertificateResource = "ACMCertificate" func init() { - register("ACMCertificate", ListACMCertificates) + resource.Register(resource.Registration{ + Name: ACMCertificateResource, + Scope: nuke.Account, + Lister: &ACMCertificateLister{}, + }) } -func ListACMCertificates(sess *session.Session) ([]Resource, error) { - svc := acm.New(sess) - resources := []Resource{} +type ACMCertificateLister struct{} + +func (l *ACMCertificateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := acm.New(opts.Session) + var resources []resource.Resource params := &acm.ListCertificatesInput{ MaxItems: aws.Int64(100), @@ -78,8 +86,14 @@ func ListACMCertificates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ACMCertificate) Remove() error { +type ACMCertificate struct { + svc *acm.ACM + certificateARN *string + certificateDetail *acm.CertificateDetail + tags []*acm.Tag +} +func (f *ACMCertificate) Remove(_ context.Context) error { _, err := f.svc.DeleteCertificate(&acm.DeleteCertificateInput{ CertificateArn: f.certificateARN, }) diff --git a/resources/acmpca-certificateauthorities.go b/resources/acmpca-certificateauthorities.go index 4286c5396..1a2ab25f1 100644 --- a/resources/acmpca-certificateauthorities.go +++ b/resources/acmpca-certificateauthorities.go @@ -1,30 +1,37 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/acmpca" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ACMPCACertificateAuthority struct { - svc *acmpca.ACMPCA - ARN *string - status *string - tags []*acmpca.Tag -} +const ACMPCACertificateAuthorityResource = "ACMPCACertificateAuthority" func init() { - register("ACMPCACertificateAuthority", ListACMPCACertificateAuthorities, - mapCloudControl("AWS::ACMPCA::CertificateAuthority")) + resource.Register(resource.Registration{ + Name: ACMPCACertificateAuthorityResource, + Scope: nuke.Account, + Lister: &ACMPCACertificateAuthorityLister{}, + }, nuke.MapCloudControl("AWS::ACMPCA::CertificateAuthority")) } -func ListACMPCACertificateAuthorities(sess *session.Session) ([]Resource, error) { - svc := acmpca.New(sess) - resources := []Resource{} - tags := []*acmpca.Tag{} +type ACMPCACertificateAuthorityLister struct{} + +func (l *ACMPCACertificateAuthorityLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := acmpca.New(opts.Session) + + var resources []resource.Resource + var tags []*acmpca.Tag params := &acmpca.ListCertificateAuthoritiesInput{ MaxResults: aws.Int64(100), @@ -72,7 +79,14 @@ func ListACMPCACertificateAuthorities(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *ACMPCACertificateAuthority) Remove() error { +type ACMPCACertificateAuthority struct { + svc *acmpca.ACMPCA + ARN *string + status *string + tags []*acmpca.Tag +} + +func (f *ACMPCACertificateAuthority) Remove(_ context.Context) error { _, err := f.svc.DeleteCertificateAuthority(&acmpca.DeleteCertificateAuthorityInput{ CertificateAuthorityArn: f.ARN, diff --git a/resources/acmpca-certificateauthoritystates.go b/resources/acmpca-certificateauthoritystates.go index 64ded2721..850494b20 100644 --- a/resources/acmpca-certificateauthoritystates.go +++ b/resources/acmpca-certificateauthoritystates.go @@ -1,29 +1,37 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/acmpca" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ACMPCACertificateAuthorityState struct { - svc *acmpca.ACMPCA - ARN *string - status *string - tags []*acmpca.Tag -} +const ACMPCACertificateAuthorityStateResource = "ACMPCACertificateAuthorityState" func init() { - register("ACMPCACertificateAuthorityState", ListACMPCACertificateAuthorityStates) + resource.Register(resource.Registration{ + Name: ACMPCACertificateAuthorityStateResource, + Scope: nuke.Account, + Lister: &ACMPCACertificateAuthorityStateLister{}, + }) } -func ListACMPCACertificateAuthorityStates(sess *session.Session) ([]Resource, error) { - svc := acmpca.New(sess) - resources := []Resource{} - tags := []*acmpca.Tag{} +type ACMPCACertificateAuthorityStateLister struct{} + +func (l *ACMPCACertificateAuthorityStateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := acmpca.New(opts.Session) + + var resources []resource.Resource + var tags []*acmpca.Tag params := &acmpca.ListCertificateAuthoritiesInput{ MaxResults: aws.Int64(100), @@ -71,7 +79,14 @@ func ListACMPCACertificateAuthorityStates(sess *session.Session) ([]Resource, er return resources, nil } -func (f *ACMPCACertificateAuthorityState) Remove() error { +type ACMPCACertificateAuthorityState struct { + svc *acmpca.ACMPCA + ARN *string + status *string + tags []*acmpca.Tag +} + +func (f *ACMPCACertificateAuthorityState) Remove(_ context.Context) error { _, err := f.svc.UpdateCertificateAuthority(&acmpca.UpdateCertificateAuthorityInput{ CertificateAuthorityArn: f.ARN, diff --git a/resources/apigateway-apikeys.go b/resources/apigateway-apikeys.go index 6f0141514..e3a0dadde 100644 --- a/resources/apigateway-apikeys.go +++ b/resources/apigateway-apikeys.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigateway" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type APIGatewayAPIKey struct { - svc *apigateway.APIGateway - APIKey *string -} +const APIGatewayAPIKeyResource = "APIGatewayAPIKey" func init() { - register("APIGatewayAPIKey", ListAPIGatewayAPIKeys, - mapCloudControl("AWS::ApiGateway::ApiKey")) + resource.Register(resource.Registration{ + Name: APIGatewayAPIKeyResource, + Scope: nuke.Account, + Lister: &APIGatewayAPIKeyLister{}, + }, nuke.MapCloudControl("AWS::ApiGateway::ApiKey")) } -func ListAPIGatewayAPIKeys(sess *session.Session) ([]Resource, error) { - svc := apigateway.New(sess) - resources := []Resource{} +type APIGatewayAPIKeyLister struct{} + +func (l *APIGatewayAPIKeyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigateway.New(opts.Session) + + var resources []resource.Resource params := &apigateway.GetApiKeysInput{ Limit: aws.Int64(100), @@ -47,7 +56,12 @@ func ListAPIGatewayAPIKeys(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *APIGatewayAPIKey) Remove() error { +type APIGatewayAPIKey struct { + svc *apigateway.APIGateway + APIKey *string +} + +func (f *APIGatewayAPIKey) Remove(_ context.Context) error { _, err := f.svc.DeleteApiKey(&apigateway.DeleteApiKeyInput{ ApiKey: f.APIKey, diff --git a/resources/apigateway-clientcertificates.go b/resources/apigateway-clientcertificates.go index 2d6dd4860..0c1147ccb 100644 --- a/resources/apigateway-clientcertificates.go +++ b/resources/apigateway-clientcertificates.go @@ -1,24 +1,32 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigateway" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type APIGatewayClientCertificate struct { - svc *apigateway.APIGateway - clientCertificateID *string -} +const APIGatewayClientCertificateResource = "APIGatewayClientCertificate" func init() { - register("APIGatewayClientCertificate", ListAPIGatewayClientCertificates, - mapCloudControl("AWS::ApiGateway::ClientCertificate")) + resource.Register(resource.Registration{ + Name: APIGatewayClientCertificateResource, + Scope: nuke.Account, + Lister: &APIGatewayClientCertificateLister{}, + }, nuke.MapCloudControl("AWS::ApiGateway::ClientCertificate")) } -func ListAPIGatewayClientCertificates(sess *session.Session) ([]Resource, error) { - svc := apigateway.New(sess) - resources := []Resource{} +type APIGatewayClientCertificateLister struct{} + +func (l *APIGatewayClientCertificateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigateway.New(opts.Session) + var resources []resource.Resource params := &apigateway.GetClientCertificatesInput{ Limit: aws.Int64(100), @@ -47,8 +55,12 @@ func ListAPIGatewayClientCertificates(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *APIGatewayClientCertificate) Remove() error { +type APIGatewayClientCertificate struct { + svc *apigateway.APIGateway + clientCertificateID *string +} +func (f *APIGatewayClientCertificate) Remove(_ context.Context) error { _, err := f.svc.DeleteClientCertificate(&apigateway.DeleteClientCertificateInput{ ClientCertificateId: f.clientCertificateID, }) diff --git a/resources/apigateway-domainnames.go b/resources/apigateway-domainnames.go index c1391481e..a4c879417 100644 --- a/resources/apigateway-domainnames.go +++ b/resources/apigateway-domainnames.go @@ -1,23 +1,32 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigateway" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type APIGatewayDomainName struct { - svc *apigateway.APIGateway - domainName *string -} +const APIGatewayDomainNameResource = "APIGatewayDomainName" func init() { - register("APIGatewayDomainName", ListAPIGatewayDomainNames) + resource.Register(resource.Registration{ + Name: APIGatewayDomainNameResource, + Scope: nuke.Account, + Lister: &APIGatewayDomainNameLister{}, + }) } -func ListAPIGatewayDomainNames(sess *session.Session) ([]Resource, error) { - svc := apigateway.New(sess) - resources := []Resource{} +type APIGatewayDomainNameLister struct{} + +func (l *APIGatewayDomainNameLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigateway.New(opts.Session) + var resources []resource.Resource params := &apigateway.GetDomainNamesInput{ Limit: aws.Int64(100), @@ -46,8 +55,12 @@ func ListAPIGatewayDomainNames(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *APIGatewayDomainName) Remove() error { +type APIGatewayDomainName struct { + svc *apigateway.APIGateway + domainName *string +} +func (f *APIGatewayDomainName) Remove(_ context.Context) error { _, err := f.svc.DeleteDomainName(&apigateway.DeleteDomainNameInput{ DomainName: f.domainName, }) diff --git a/resources/apigateway-restapis.go b/resources/apigateway-restapis.go index 614be8f14..7bff13c39 100644 --- a/resources/apigateway-restapis.go +++ b/resources/apigateway-restapis.go @@ -1,12 +1,29 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const APIGatewayRestAPIResource = "APIGatewayRestAPI" + +func init() { + resource.Register(resource.Registration{ + Name: APIGatewayRestAPIResource, + Scope: nuke.Account, + Lister: &APIGatewayRestAPILister{}, + }) +} + +type APIGatewayRestAPILister struct{} + type APIGatewayRestAPI struct { svc *apigateway.APIGateway restAPIID *string @@ -15,13 +32,11 @@ type APIGatewayRestAPI struct { tags map[string]*string } -func init() { - register("APIGatewayRestAPI", ListAPIGatewayRestApis) -} +func (l *APIGatewayRestAPILister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigateway.New(opts.Session) -func ListAPIGatewayRestApis(sess *session.Session) ([]Resource, error) { - svc := apigateway.New(sess) - resources := []Resource{} + var resources []resource.Resource params := &apigateway.GetRestApisInput{ Limit: aws.Int64(100), @@ -53,8 +68,7 @@ func ListAPIGatewayRestApis(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *APIGatewayRestAPI) Remove() error { - +func (f *APIGatewayRestAPI) Remove(_ context.Context) error { _, err := f.svc.DeleteRestApi(&apigateway.DeleteRestApiInput{ RestApiId: f.restAPIID, }) diff --git a/resources/apigateway-usageplans.go b/resources/apigateway-usageplans.go index a68525496..18ae5c7d3 100644 --- a/resources/apigateway-usageplans.go +++ b/resources/apigateway-usageplans.go @@ -1,12 +1,29 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const APIGatewayUsagePlanResource = "APIGatewayUsagePlan" + +func init() { + resource.Register(resource.Registration{ + Name: APIGatewayUsagePlanResource, + Scope: nuke.Account, + Lister: &APIGatewayUsagePlanLister{}, + }, nuke.MapCloudControl("AWS::ApiGateway::UsagePlan")) +} + +type APIGatewayUsagePlanLister struct{} + type APIGatewayUsagePlan struct { svc *apigateway.APIGateway usagePlanID *string @@ -14,14 +31,10 @@ type APIGatewayUsagePlan struct { tags map[string]*string } -func init() { - register("APIGatewayUsagePlan", ListAPIGatewayUsagePlans, - mapCloudControl("AWS::ApiGateway::UsagePlan")) -} - -func ListAPIGatewayUsagePlans(sess *session.Session) ([]Resource, error) { - svc := apigateway.New(sess) - resources := []Resource{} +func (l *APIGatewayUsagePlanLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigateway.New(opts.Session) + var resources []resource.Resource params := &apigateway.GetUsagePlansInput{ Limit: aws.Int64(100), @@ -52,8 +65,7 @@ func ListAPIGatewayUsagePlans(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *APIGatewayUsagePlan) Remove() error { - +func (f *APIGatewayUsagePlan) Remove(_ context.Context) error { _, err := f.svc.DeleteUsagePlan(&apigateway.DeleteUsagePlanInput{ UsagePlanId: f.usagePlanID, }) diff --git a/resources/apigateway-vpclinks.go b/resources/apigateway-vpclinks.go index 944a1bc84..edee61b95 100644 --- a/resources/apigateway-vpclinks.go +++ b/resources/apigateway-vpclinks.go @@ -1,26 +1,31 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" ) -type APIGatewayVpcLink struct { - svc *apigateway.APIGateway - vpcLinkID *string - name *string - tags map[string]*string -} +const APIGatewayVpcLinkResource = "APIGatewayVpcLink" func init() { - register("APIGatewayVpcLink", ListAPIGatewayVpcLinks) + resource.Register(resource.Registration{ + Name: APIGatewayVpcLinkResource, + Scope: nuke.Account, + Lister: &APIGatewayVpcLinkLister{}, + }) } -func ListAPIGatewayVpcLinks(sess *session.Session) ([]Resource, error) { - svc := apigateway.New(sess) - resources := []Resource{} +type APIGatewayVpcLinkLister struct{} + +func (l *APIGatewayVpcLinkLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigateway.New(opts.Session) + var resources []resource.Resource params := &apigateway.GetVpcLinksInput{ Limit: aws.Int64(100), @@ -51,8 +56,14 @@ func ListAPIGatewayVpcLinks(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *APIGatewayVpcLink) Remove() error { +type APIGatewayVpcLink struct { + svc *apigateway.APIGateway + vpcLinkID *string + name *string + tags map[string]*string +} +func (f *APIGatewayVpcLink) Remove(_ context.Context) error { _, err := f.svc.DeleteVpcLink(&apigateway.DeleteVpcLinkInput{ VpcLinkId: f.vpcLinkID, }) diff --git a/resources/apigatewayv2-apis.go b/resources/apigatewayv2-apis.go index 304c656b2..09fd450d9 100644 --- a/resources/apigatewayv2-apis.go +++ b/resources/apigatewayv2-apis.go @@ -1,28 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigatewayv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type APIGatewayV2API struct { - svc *apigatewayv2.ApiGatewayV2 - v2APIID *string - name *string - protocolType *string - version *string - tags map[string]*string -} +const APIGatewayV2APIResource = "APIGatewayV2API" func init() { - register("APIGatewayV2API", ListAPIGatewayV2APIs) + resource.Register(resource.Registration{ + Name: APIGatewayV2APIResource, + Scope: nuke.Account, + Lister: &APIGatewayV2APILister{}, + }) } -func ListAPIGatewayV2APIs(sess *session.Session) ([]Resource, error) { - svc := apigatewayv2.New(sess) - resources := []Resource{} +type APIGatewayV2APILister struct{} + +func (l *APIGatewayV2APILister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigatewayv2.New(opts.Session) + var resources []resource.Resource params := &apigatewayv2.GetApisInput{ MaxResults: aws.String("100"), @@ -55,8 +60,16 @@ func ListAPIGatewayV2APIs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *APIGatewayV2API) Remove() error { +type APIGatewayV2API struct { + svc *apigatewayv2.ApiGatewayV2 + v2APIID *string + name *string + protocolType *string + version *string + tags map[string]*string +} +func (f *APIGatewayV2API) Remove(_ context.Context) error { _, err := f.svc.DeleteApi(&apigatewayv2.DeleteApiInput{ ApiId: f.v2APIID, }) diff --git a/resources/apigatewayv2-vpclinks.go b/resources/apigatewayv2-vpc-links.go similarity index 64% rename from resources/apigatewayv2-vpclinks.go rename to resources/apigatewayv2-vpc-links.go index 2c1dab146..18b4da3a4 100644 --- a/resources/apigatewayv2-vpclinks.go +++ b/resources/apigatewayv2-vpc-links.go @@ -1,26 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/apigatewayv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type APIGatewayV2VpcLink struct { - svc *apigatewayv2.ApiGatewayV2 - vpcLinkID *string - name *string - tags map[string]*string -} +const APIGatewayV2VpcLinkResource = "APIGatewayV2VpcLink" func init() { - register("APIGatewayV2VpcLink", ListAPIGatewayV2VpcLinks) + resource.Register(resource.Registration{ + Name: APIGatewayV2VpcLinkResource, + Scope: nuke.Account, + Lister: &APIGatewayV2VpcLinkLister{}, + }) } -func ListAPIGatewayV2VpcLinks(sess *session.Session) ([]Resource, error) { - svc := apigatewayv2.New(sess) - resources := []Resource{} +type APIGatewayV2VpcLinkLister struct{} + +func (l *APIGatewayV2VpcLinkLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := apigatewayv2.New(opts.Session) + var resources []resource.Resource params := &apigatewayv2.GetVpcLinksInput{ MaxResults: aws.String("100"), @@ -51,8 +58,14 @@ func ListAPIGatewayV2VpcLinks(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *APIGatewayV2VpcLink) Remove() error { +type APIGatewayV2VpcLink struct { + svc *apigatewayv2.ApiGatewayV2 + vpcLinkID *string + name *string + tags map[string]*string +} +func (f *APIGatewayV2VpcLink) Remove(_ context.Context) error { _, err := f.svc.DeleteVpcLink(&apigatewayv2.DeleteVpcLinkInput{ VpcLinkId: f.vpcLinkID, }) diff --git a/resources/applicationautoscalingscalabletargets.go b/resources/applicationautoscaling-scalable-targets.go similarity index 67% rename from resources/applicationautoscalingscalabletargets.go rename to resources/applicationautoscaling-scalable-targets.go index 066cbefb1..39d33a3a9 100644 --- a/resources/applicationautoscalingscalabletargets.go +++ b/resources/applicationautoscaling-scalable-targets.go @@ -1,31 +1,36 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/applicationautoscaling" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AppAutoScaling struct { - svc *applicationautoscaling.ApplicationAutoScaling - target *applicationautoscaling.ScalableTarget - id string - roleARN string - dimension string - namespace string -} +const ApplicationAutoScalingScalableTargetResource = "ApplicationAutoScalingScalableTarget" func init() { - register("ApplicationAutoScalingScalableTarget", ListApplicationAutoScalingScalableTargets) + resource.Register(resource.Registration{ + Name: ApplicationAutoScalingScalableTargetResource, + Scope: nuke.Account, + Lister: &ApplicationAutoScalingScalableTargetLister{}, + }) } -func ListApplicationAutoScalingScalableTargets(sess *session.Session) ([]Resource, error) { - svc := applicationautoscaling.New(sess) +type ApplicationAutoScalingScalableTargetLister struct{} + +func (l *ApplicationAutoScalingScalableTargetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := applicationautoscaling.New(opts.Session) namespaces := applicationautoscaling.ServiceNamespace_Values() params := &applicationautoscaling.DescribeScalableTargetsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, namespace := range namespaces { for { params.ServiceNamespace = &namespace @@ -55,7 +60,16 @@ func ListApplicationAutoScalingScalableTargets(sess *session.Session) ([]Resourc return resources, nil } -func (a *AppAutoScaling) Remove() error { +type AppAutoScaling struct { + svc *applicationautoscaling.ApplicationAutoScaling + target *applicationautoscaling.ScalableTarget + id string + roleARN string + dimension string + namespace string +} + +func (a *AppAutoScaling) Remove(_ context.Context) error { _, err := a.svc.DeregisterScalableTarget(&applicationautoscaling.DeregisterScalableTargetInput{ ResourceId: &a.id, ScalableDimension: &a.dimension, diff --git a/resources/appmesh-gatewayroute.go b/resources/appmesh-gatewayroute.go index 2574bcd9c..ba7df7df7 100644 --- a/resources/appmesh-gatewayroute.go +++ b/resources/appmesh-gatewayroute.go @@ -1,25 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appmesh" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AppMeshGatewayRoute struct { - svc *appmesh.AppMesh - routeName *string - meshName *string - virtualGatewayName *string -} +const AppMeshGatewayRouteResource = "AppMeshGatewayRoute" func init() { - register("AppMeshGatewayRoute", ListAppMeshGatewayRoutes) + resource.Register(resource.Registration{ + Name: AppMeshGatewayRouteResource, + Scope: nuke.Account, + Lister: &AppMeshGatewayRouteLister{}, + }) } -func ListAppMeshGatewayRoutes(sess *session.Session) ([]Resource, error) { - svc := appmesh.New(sess) - resources := []Resource{} +type AppMeshGatewayRouteLister struct{} + +func (l *AppMeshGatewayRouteLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := appmesh.New(opts.Session) + var resources []resource.Resource // Get Meshes var meshNames []*string @@ -86,7 +93,14 @@ func ListAppMeshGatewayRoutes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppMeshGatewayRoute) Remove() error { +type AppMeshGatewayRoute struct { + svc *appmesh.AppMesh + routeName *string + meshName *string + virtualGatewayName *string +} + +func (f *AppMeshGatewayRoute) Remove(_ context.Context) error { _, err := f.svc.DeleteGatewayRoute(&appmesh.DeleteGatewayRouteInput{ MeshName: f.meshName, GatewayRouteName: f.routeName, diff --git a/resources/appmesh-mesh.go b/resources/appmesh-mesh.go index e0c2e35fa..d7130e5d5 100644 --- a/resources/appmesh-mesh.go +++ b/resources/appmesh-mesh.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appmesh" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AppMeshMesh struct { - svc *appmesh.AppMesh - meshName *string -} +const AppMeshMeshResource = "AppMeshMesh" func init() { - register("AppMeshMesh", ListAppMeshMeshes) + resource.Register(resource.Registration{ + Name: AppMeshMeshResource, + Scope: nuke.Account, + Lister: &AppMeshMeshLister{}, + }) } -func ListAppMeshMeshes(sess *session.Session) ([]Resource, error) { - svc := appmesh.New(sess) - resources := []Resource{} +type AppMeshMeshLister struct{} + +func (l *AppMeshMeshLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := appmesh.New(opts.Session) + var resources []resource.Resource params := &appmesh.ListMeshesInput{ Limit: aws.Int64(100), @@ -47,7 +56,12 @@ func ListAppMeshMeshes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppMeshMesh) Remove() error { +type AppMeshMesh struct { + svc *appmesh.AppMesh + meshName *string +} + +func (f *AppMeshMesh) Remove(_ context.Context) error { _, err := f.svc.DeleteMesh(&appmesh.DeleteMeshInput{ MeshName: f.meshName, }) diff --git a/resources/appmesh-route.go b/resources/appmesh-route.go index 2d2490075..467e22f53 100644 --- a/resources/appmesh-route.go +++ b/resources/appmesh-route.go @@ -1,25 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appmesh" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AppMeshRoute struct { - svc *appmesh.AppMesh - routeName *string - meshName *string - virtualRouterName *string -} +const AppMeshRouteResource = "AppMeshRoute" func init() { - register("AppMeshRoute", ListAppMeshRoutes) + resource.Register(resource.Registration{ + Name: AppMeshRouteResource, + Scope: nuke.Account, + Lister: &AppMeshRouteLister{}, + }) } -func ListAppMeshRoutes(sess *session.Session) ([]Resource, error) { - svc := appmesh.New(sess) - resources := []Resource{} +type AppMeshRouteLister struct{} + +func (l *AppMeshRouteLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := appmesh.New(opts.Session) + var resources []resource.Resource // Get Meshes var meshNames []*string @@ -86,7 +93,14 @@ func ListAppMeshRoutes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppMeshRoute) Remove() error { +type AppMeshRoute struct { + svc *appmesh.AppMesh + routeName *string + meshName *string + virtualRouterName *string +} + +func (f *AppMeshRoute) Remove(_ context.Context) error { _, err := f.svc.DeleteRoute(&appmesh.DeleteRouteInput{ MeshName: f.meshName, RouteName: f.routeName, diff --git a/resources/appmesh-virtualgateway.go b/resources/appmesh-virtualgateway.go index 913150fd2..acbca2806 100644 --- a/resources/appmesh-virtualgateway.go +++ b/resources/appmesh-virtualgateway.go @@ -1,24 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appmesh" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AppMeshVirtualGateway struct { - svc *appmesh.AppMesh - meshName *string - virtualGatewayName *string -} +const AppMeshVirtualGatewayResource = "AppMeshVirtualGateway" func init() { - register("AppMeshVirtualGateway", ListAppMeshVirtualGateways) + resource.Register(resource.Registration{ + Name: AppMeshVirtualGatewayResource, + Scope: nuke.Account, + Lister: &AppMeshVirtualGatewayLister{}, + }) } -func ListAppMeshVirtualGateways(sess *session.Session) ([]Resource, error) { - svc := appmesh.New(sess) - resources := []Resource{} +type AppMeshVirtualGatewayLister struct{} + +func (l *AppMeshVirtualGatewayLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := appmesh.New(opts.Session) + var resources []resource.Resource // Get Meshes var meshNames []*string @@ -66,7 +74,13 @@ func ListAppMeshVirtualGateways(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppMeshVirtualGateway) Remove() error { +type AppMeshVirtualGateway struct { + svc *appmesh.AppMesh + meshName *string + virtualGatewayName *string +} + +func (f *AppMeshVirtualGateway) Remove(_ context.Context) error { _, err := f.svc.DeleteVirtualGateway(&appmesh.DeleteVirtualGatewayInput{ MeshName: f.meshName, VirtualGatewayName: f.virtualGatewayName, diff --git a/resources/appmesh-virtualnode.go b/resources/appmesh-virtualnode.go index b7f3c02e9..a33af143e 100644 --- a/resources/appmesh-virtualnode.go +++ b/resources/appmesh-virtualnode.go @@ -1,24 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appmesh" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AppMeshVirtualNode struct { - svc *appmesh.AppMesh - meshName *string - virtualNodeName *string -} +const AppMeshVirtualNodeResource = "AppMeshVirtualNode" func init() { - register("AppMeshVirtualNode", ListAppMeshVirtualNodes) + resource.Register(resource.Registration{ + Name: AppMeshVirtualNodeResource, + Scope: nuke.Account, + Lister: &AppMeshVirtualNodeLister{}, + }) } -func ListAppMeshVirtualNodes(sess *session.Session) ([]Resource, error) { - svc := appmesh.New(sess) - resources := []Resource{} +type AppMeshVirtualNodeLister struct{} + +func (l *AppMeshVirtualNodeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appmesh.New(opts.Session) + resources := make([]resource.Resource, 0) // Get Meshes var meshNames []*string @@ -66,7 +75,13 @@ func ListAppMeshVirtualNodes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppMeshVirtualNode) Remove() error { +type AppMeshVirtualNode struct { + svc *appmesh.AppMesh + meshName *string + virtualNodeName *string +} + +func (f *AppMeshVirtualNode) Remove(_ context.Context) error { _, err := f.svc.DeleteVirtualNode(&appmesh.DeleteVirtualNodeInput{ MeshName: f.meshName, VirtualNodeName: f.virtualNodeName, diff --git a/resources/appmesh-virtualrouter.go b/resources/appmesh-virtualrouter.go index 969499b53..e2e5d0a48 100644 --- a/resources/appmesh-virtualrouter.go +++ b/resources/appmesh-virtualrouter.go @@ -1,9 +1,14 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appmesh" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppMeshVirtualRouter struct { @@ -12,13 +17,23 @@ type AppMeshVirtualRouter struct { virtualRouterName *string } +const AppMeshVirtualRouterResource = "AppMeshVirtualRouter" + func init() { - register("AppMeshVirtualRouter", ListAppMeshVirtualRouters) + resource.Register(resource.Registration{ + Name: AppMeshVirtualRouterResource, + Scope: nuke.Account, + Lister: &AppMeshVirtualRouterLister{}, + }) } -func ListAppMeshVirtualRouters(sess *session.Session) ([]Resource, error) { - svc := appmesh.New(sess) - resources := []Resource{} +type AppMeshVirtualRouterLister struct{} + +func (l *AppMeshVirtualRouterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appmesh.New(opts.Session) + resources := make([]resource.Resource, 0) // Get Meshes var meshNames []*string @@ -66,7 +81,7 @@ func ListAppMeshVirtualRouters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppMeshVirtualRouter) Remove() error { +func (f *AppMeshVirtualRouter) Remove(_ context.Context) error { _, err := f.svc.DeleteVirtualRouter(&appmesh.DeleteVirtualRouterInput{ MeshName: f.meshName, VirtualRouterName: f.virtualRouterName, diff --git a/resources/appmesh-virtualservice.go b/resources/appmesh-virtualservice.go index 41ed84980..5bebe847e 100644 --- a/resources/appmesh-virtualservice.go +++ b/resources/appmesh-virtualservice.go @@ -1,9 +1,14 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appmesh" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppMeshVirtualService struct { @@ -12,13 +17,23 @@ type AppMeshVirtualService struct { virtualServiceName *string } +const AppMeshVirtualServiceResource = "AppMeshVirtualService" + func init() { - register("AppMeshVirtualService", ListAppMeshVirtualServices) + resource.Register(resource.Registration{ + Name: AppMeshVirtualServiceResource, + Scope: nuke.Account, + Lister: &AppMeshVirtualServiceLister{}, + }) } -func ListAppMeshVirtualServices(sess *session.Session) ([]Resource, error) { - svc := appmesh.New(sess) - resources := []Resource{} +type AppMeshVirtualServiceLister struct{} + +func (l *AppMeshVirtualServiceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appmesh.New(opts.Session) + resources := make([]resource.Resource, 0) // Get Meshes var meshNames []*string @@ -66,7 +81,7 @@ func ListAppMeshVirtualServices(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppMeshVirtualService) Remove() error { +func (f *AppMeshVirtualService) Remove(_ context.Context) error { _, err := f.svc.DeleteVirtualService(&appmesh.DeleteVirtualServiceInput{ MeshName: f.meshName, VirtualServiceName: f.virtualServiceName, diff --git a/resources/appstream-directoryconfigs.go b/resources/appstream-directoryconfigs.go index 9ff4e4181..a860cbb05 100644 --- a/resources/appstream-directoryconfigs.go +++ b/resources/appstream-directoryconfigs.go @@ -1,9 +1,14 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppStreamDirectoryConfig struct { @@ -11,13 +16,23 @@ type AppStreamDirectoryConfig struct { name *string } +const AppStreamDirectoryConfigResource = "AppStreamDirectoryConfig" + func init() { - register("AppStreamDirectoryConfig", ListAppStreamDirectoryConfigs) + resource.Register(resource.Registration{ + Name: AppStreamDirectoryConfigResource, + Scope: nuke.Account, + Lister: &AppStreamDirectoryConfigLister{}, + }) } -func ListAppStreamDirectoryConfigs(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} +type AppStreamDirectoryConfigLister struct{} + +func (l *AppStreamDirectoryConfigLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) params := &appstream.DescribeDirectoryConfigsInput{ MaxResults: aws.Int64(100), @@ -46,8 +61,7 @@ func ListAppStreamDirectoryConfigs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppStreamDirectoryConfig) Remove() error { - +func (f *AppStreamDirectoryConfig) Remove(_ context.Context) error { _, err := f.svc.DeleteDirectoryConfig(&appstream.DeleteDirectoryConfigInput{ DirectoryName: f.name, }) diff --git a/resources/appstream-fleets.go b/resources/appstream-fleets.go index 2969997a7..0b65de933 100644 --- a/resources/appstream-fleets.go +++ b/resources/appstream-fleets.go @@ -1,8 +1,12 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) type AppStreamFleet struct { @@ -10,13 +14,23 @@ type AppStreamFleet struct { name *string } +const AppStreamFleetResource = "AppStreamFleet" + func init() { - register("AppStreamFleet", ListAppStreamFleets) + resource.Register(resource.Registration{ + Name: AppStreamFleetResource, + Scope: nuke.Account, + Lister: &AppStreamFleetLister{}, + }) } -func ListAppStreamFleets(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} +type AppStreamFleetLister struct{} + +func (l *AppStreamFleetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) params := &appstream.DescribeFleetsInput{} @@ -43,8 +57,7 @@ func ListAppStreamFleets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppStreamFleet) Remove() error { - +func (f *AppStreamFleet) Remove(_ context.Context) error { _, err := f.svc.StopFleet(&appstream.StopFleetInput{ Name: f.name, }) diff --git a/resources/appstream-fleetstates.go b/resources/appstream-fleetstates.go index e703c501e..48324fba4 100644 --- a/resources/appstream-fleetstates.go +++ b/resources/appstream-fleetstates.go @@ -1,10 +1,15 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppStreamFleetState struct { @@ -13,13 +18,23 @@ type AppStreamFleetState struct { state *string } +const AppStreamFleetStateResource = "AppStreamFleetState" + func init() { - register("AppStreamFleetState", ListAppStreamFleetStates) + resource.Register(resource.Registration{ + Name: AppStreamFleetStateResource, + Scope: nuke.Account, + Lister: &AppStreamFleetStateLister{}, + }) } -func ListAppStreamFleetStates(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} +type AppStreamFleetStateLister struct{} + +func (l *AppStreamFleetStateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) params := &appstream.DescribeFleetsInput{} @@ -47,7 +62,7 @@ func ListAppStreamFleetStates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppStreamFleetState) Remove() error { +func (f *AppStreamFleetState) Remove(_ context.Context) error { _, err := f.svc.StopFleet(&appstream.StopFleetInput{ Name: f.name, diff --git a/resources/appstream-imagebuilders.go b/resources/appstream-imagebuilders.go index 735434a16..1c3e7b64f 100644 --- a/resources/appstream-imagebuilders.go +++ b/resources/appstream-imagebuilders.go @@ -1,9 +1,14 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppStreamImageBuilder struct { @@ -11,13 +16,23 @@ type AppStreamImageBuilder struct { name *string } +const AppStreamImageBuilderResource = "AppStreamImageBuilder" + func init() { - register("AppStreamImageBuilder", ListAppStreamImageBuilders) + resource.Register(resource.Registration{ + Name: AppStreamImageBuilderResource, + Scope: nuke.Account, + Lister: &AppStreamImageBuilderLister{}, + }) } -func ListAppStreamImageBuilders(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} +type AppStreamImageBuilderLister struct{} + +func (l *AppStreamImageBuilderLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) params := &appstream.DescribeImageBuildersInput{ MaxResults: aws.Int64(100), @@ -46,8 +61,7 @@ func ListAppStreamImageBuilders(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppStreamImageBuilder) Remove() error { - +func (f *AppStreamImageBuilder) Remove(_ context.Context) error { _, err := f.svc.DeleteImageBuilder(&appstream.DeleteImageBuilderInput{ Name: f.name, }) diff --git a/resources/appstream-imagebuilderwaiters.go b/resources/appstream-imagebuilderwaiters.go index fc5faf831..bd97f6708 100644 --- a/resources/appstream-imagebuilderwaiters.go +++ b/resources/appstream-imagebuilderwaiters.go @@ -1,11 +1,16 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppStreamImageBuilderWaiter struct { @@ -14,13 +19,23 @@ type AppStreamImageBuilderWaiter struct { state *string } +const AppStreamImageBuilderWaiterResource = "AppStreamImageBuilderWaiter" + func init() { - register("AppStreamImageBuilderWaiter", ListAppStreamImageBuilderWaiters) + resource.Register(resource.Registration{ + Name: AppStreamImageBuilderWaiterResource, + Scope: nuke.Account, + Lister: &AppStreamImageBuilderWaiterLister{}, + }) } -func ListAppStreamImageBuilderWaiters(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} +type AppStreamImageBuilderWaiterLister struct{} + +func (l *AppStreamImageBuilderWaiterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) params := &appstream.DescribeImageBuildersInput{ MaxResults: aws.Int64(100), @@ -50,7 +65,7 @@ func ListAppStreamImageBuilderWaiters(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *AppStreamImageBuilderWaiter) Remove() error { +func (f *AppStreamImageBuilderWaiter) Remove(_ context.Context) error { return nil } diff --git a/resources/appstream-images.go b/resources/appstream-images.go index 4530d26cc..914ad1923 100644 --- a/resources/appstream-images.go +++ b/resources/appstream-images.go @@ -1,11 +1,16 @@ package resources import ( + "context" + "fmt" "strings" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppStreamImage struct { @@ -14,13 +19,23 @@ type AppStreamImage struct { visibility *string } +const AppStreamImageResource = "AppStreamImage" + func init() { - register("AppStreamImage", ListAppStreamImages) + resource.Register(resource.Registration{ + Name: AppStreamImageResource, + Scope: nuke.Account, + Lister: &AppStreamImageLister{}, + }) } -func ListAppStreamImages(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} +type AppStreamImageLister struct{} + +func (l *AppStreamImageLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) params := &appstream.DescribeImagesInput{} @@ -40,8 +55,7 @@ func ListAppStreamImages(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppStreamImage) Remove() error { - +func (f *AppStreamImage) Remove(_ context.Context) error { _, err := f.svc.DeleteImage(&appstream.DeleteImageInput{ Name: f.name, }) diff --git a/resources/appstream-stack-fleet-attachments.go b/resources/appstream-stack-fleet-attachments.go index c156ffe7c..a5d1eadb1 100644 --- a/resources/appstream-stack-fleet-attachments.go +++ b/resources/appstream-stack-fleet-attachments.go @@ -1,10 +1,15 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type AppStreamStackFleetAttachment struct { @@ -13,14 +18,24 @@ type AppStreamStackFleetAttachment struct { fleetName *string } +const AppStreamStackFleetAttachmentResource = "AppStreamStackFleetAttachment" + func init() { - register("AppStreamStackFleetAttachment", ListAppStreamStackFleetAttachments) + resource.Register(resource.Registration{ + Name: AppStreamStackFleetAttachmentResource, + Scope: nuke.Account, + Lister: &AppStreamStackFleetAttachmentLister{}, + }) } -func ListAppStreamStackFleetAttachments(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} - stacks := []*appstream.Stack{} +type AppStreamStackFleetAttachmentLister struct{} + +func (l *AppStreamStackFleetAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) + var stacks []*appstream.Stack params := &appstream.DescribeStacksInput{} for { @@ -61,7 +76,7 @@ func ListAppStreamStackFleetAttachments(sess *session.Session) ([]Resource, erro return resources, nil } -func (f *AppStreamStackFleetAttachment) Remove() error { +func (f *AppStreamStackFleetAttachment) Remove(_ context.Context) error { _, err := f.svc.DisassociateFleet(&appstream.DisassociateFleetInput{ StackName: f.stackName, diff --git a/resources/appstream-stacks.go b/resources/appstream-stacks.go index 1c3f64027..39cd0098b 100644 --- a/resources/appstream-stacks.go +++ b/resources/appstream-stacks.go @@ -1,8 +1,12 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/appstream" + + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) type AppStreamStack struct { @@ -10,13 +14,23 @@ type AppStreamStack struct { name *string } +const AppStreamStackResource = "AppStreamStack" + func init() { - register("AppStreamStack", ListAppStreamStacks) + resource.Register(resource.Registration{ + Name: AppStreamStackResource, + Scope: nuke.Account, + Lister: &AppStreamStackLister{}, + }) } -func ListAppStreamStacks(sess *session.Session) ([]Resource, error) { - svc := appstream.New(sess) - resources := []Resource{} +type AppStreamStackLister struct{} + +func (l *AppStreamStackLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := appstream.New(opts.Session) + resources := make([]resource.Resource, 0) params := &appstream.DescribeStacksInput{} @@ -43,8 +57,7 @@ func ListAppStreamStacks(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AppStreamStack) Remove() error { - +func (f *AppStreamStack) Remove(_ context.Context) error { _, err := f.svc.DeleteStack(&appstream.DeleteStackInput{ Name: f.name, }) diff --git a/resources/appsync-graphqlapis.go b/resources/appsync-graphqlapis.go index 586e77f0d..967d12365 100644 --- a/resources/appsync-graphqlapis.go +++ b/resources/appsync-graphqlapis.go @@ -1,28 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/appsync" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -// AppSyncGraphqlAPI - An AWS AppSync GraphQL API -type AppSyncGraphqlAPI struct { - svc *appsync.AppSync - apiID *string - name *string - tags map[string]*string -} +const AppSyncGraphqlAPIResource = "AppSyncGraphqlAPI" func init() { - register("AppSyncGraphqlAPI", ListAppSyncGraphqlAPIs) + resource.Register(resource.Registration{ + Name: AppSyncGraphqlAPIResource, + Scope: nuke.Account, + Lister: &AppSyncGraphqlAPILister{}, + }) } -// ListAppSyncGraphqlAPIs - List all AWS AppSync GraphQL APIs in the account -func ListAppSyncGraphqlAPIs(sess *session.Session) ([]Resource, error) { - svc := appsync.New(sess) - resources := []Resource{} +type AppSyncGraphqlAPILister struct{} + +// List - List all AWS AppSync GraphQL APIs in the account +func (l *AppSyncGraphqlAPILister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := appsync.New(opts.Session) + var resources []resource.Resource params := &appsync.ListGraphqlApisInput{ MaxResults: aws.Int64(25), @@ -53,8 +59,16 @@ func ListAppSyncGraphqlAPIs(sess *session.Session) ([]Resource, error) { return resources, nil } +// AppSyncGraphqlAPI - An AWS AppSync GraphQL API +type AppSyncGraphqlAPI struct { + svc *appsync.AppSync + apiID *string + name *string + tags map[string]*string +} + // Remove - remove an AWS AppSync GraphQL API -func (f *AppSyncGraphqlAPI) Remove() error { +func (f *AppSyncGraphqlAPI) Remove(_ context.Context) error { _, err := f.svc.DeleteGraphqlApi(&appsync.DeleteGraphqlApiInput{ ApiId: f.apiID, }) diff --git a/resources/athena-named-queries.go b/resources/athena-named-queries.go index acc002c67..55f44a623 100644 --- a/resources/athena-named-queries.go +++ b/resources/athena-named-queries.go @@ -1,24 +1,38 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/athena" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const AthenaNamedQueryResource = "AthenaNamedQuery" + func init() { - register("AthenaNamedQuery", ListAthenaNamedQueries, - mapCloudControl("AWS::Athena::NamedQuery")) + resource.Register(resource.Registration{ + Name: AthenaNamedQueryResource, + Scope: nuke.Account, + Lister: &AthenaNamedQueryLister{}, + }) } +type AthenaNamedQueryLister struct{} + type AthenaNamedQuery struct { svc *athena.Athena id *string } -func ListAthenaNamedQueries(sess *session.Session) ([]Resource, error) { - svc := athena.New(sess) - resources := []Resource{} +func (l *AthenaNamedQueryLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := athena.New(opts.Session) + resources := make([]resource.Resource, 0) // List WorkGroup var workgroupNames []*string @@ -61,7 +75,7 @@ func ListAthenaNamedQueries(sess *session.Session) ([]Resource, error) { return resources, err } -func (a *AthenaNamedQuery) Remove() error { +func (a *AthenaNamedQuery) Remove(_ context.Context) error { _, err := a.svc.DeleteNamedQuery(&athena.DeleteNamedQueryInput{ NamedQueryId: a.id, }) diff --git a/resources/athena-work-groups.go b/resources/athena-work-groups.go index d1de23616..6bb43bfeb 100644 --- a/resources/athena-work-groups.go +++ b/resources/athena-work-groups.go @@ -1,34 +1,49 @@ package resources import ( + "context" + "errors" "fmt" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/athena" "github.com/aws/aws-sdk-go/service/sts" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const AthenaWorkGroupResource = "AthenaWorkGroup" + func init() { - register("AthenaWorkGroup", ListAthenaWorkGroups, - mapCloudControl("AWS::Athena::WorkGroup")) + resource.Register(resource.Registration{ + Name: AthenaWorkGroupResource, + Scope: nuke.Account, + Lister: &AthenaWorkGroupLister{}, + }) } +type AthenaWorkGroupLister struct{} + type AthenaWorkGroup struct { svc *athena.Athena name *string arn *string } -func ListAthenaWorkGroups(sess *session.Session) ([]Resource, error) { - svc := athena.New(sess) - resources := []Resource{} +func (l *AthenaWorkGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := athena.New(opts.Session) + resources := make([]resource.Resource, 0) // Lookup current account ID - stsSvc := sts.New(sess) + stsSvc := sts.New(opts.Session) callerID, err := stsSvc.GetCallerIdentity(&sts.GetCallerIdentityInput{}) if err != nil { return nil, err @@ -68,10 +83,11 @@ func ListAthenaWorkGroups(sess *session.Session) ([]Resource, error) { return resources, err } -func (a *AthenaWorkGroup) Remove() error { +func (a *AthenaWorkGroup) Remove(_ context.Context) error { // Primary WorkGroup cannot be deleted, // but we can reset it to a clean state if *a.name == "primary" { + // TODO: pass logger via ListerOpts instead of using global logrus.Info("Primary Athena WorkGroup may not be deleted. Resetting configuration only.") // Reset the configuration to its default state diff --git a/resources/autoscaling-groups.go b/resources/autoscaling-groups.go index 5f41ec7d9..264c767be 100644 --- a/resources/autoscaling-groups.go +++ b/resources/autoscaling-groups.go @@ -1,19 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/autoscaling" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const AutoScalingGroupResource = "AutoScalingGroup" + func init() { - register("AutoScalingGroup", ListAutoscalingGroups) + resource.Register(resource.Registration{ + Name: AutoScalingGroupResource, + Scope: nuke.Account, + Lister: &AutoScalingGroupLister{}, + }) } -func ListAutoscalingGroups(s *session.Session) ([]Resource, error) { - svc := autoscaling.New(s) - resources := make([]Resource, 0) +type AutoScalingGroupLister struct{} + +func (l *AutoScalingGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := autoscaling.New(opts.Session) + resources := make([]resource.Resource, 0) params := &autoscaling.DescribeAutoScalingGroupsInput{} err := svc.DescribeAutoScalingGroupsPages(params, @@ -41,7 +56,7 @@ type AutoScalingGroup struct { tags []*autoscaling.TagDescription } -func (asg *AutoScalingGroup) Remove() error { +func (asg *AutoScalingGroup) Remove(_ context.Context) error { params := &autoscaling.DeleteAutoScalingGroupInput{ AutoScalingGroupName: asg.group.AutoScalingGroupName, ForceDelete: aws.Bool(true), diff --git a/resources/autoscaling-launch-configurations.go b/resources/autoscaling-launch-configurations.go new file mode 100644 index 000000000..2790857ad --- /dev/null +++ b/resources/autoscaling-launch-configurations.go @@ -0,0 +1,72 @@ +package resources + +import ( + "context" + + "github.com/aws/aws-sdk-go/service/autoscaling" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +// TODO: review if this should be prefixed with Autoscaling + +const LaunchConfigurationResource = "LaunchConfiguration" + +func init() { + resource.Register(resource.Registration{ + Name: LaunchConfigurationResource, + Scope: nuke.Account, + Lister: &LaunchConfigurationLister{}, + }) +} + +type LaunchConfigurationLister struct{} + +func (l *LaunchConfigurationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + resources := make([]resource.Resource, 0) + svc := autoscaling.New(opts.Session) + + params := &autoscaling.DescribeLaunchConfigurationsInput{} + err := svc.DescribeLaunchConfigurationsPages(params, + func(page *autoscaling.DescribeLaunchConfigurationsOutput, lastPage bool) bool { + for _, launchConfig := range page.LaunchConfigurations { + resources = append(resources, &LaunchConfiguration{ + svc: svc, + name: launchConfig.LaunchConfigurationName, + }) + } + return !lastPage + }) + + if err != nil { + return nil, err + } + + return resources, nil +} + +type LaunchConfiguration struct { + svc *autoscaling.AutoScaling + name *string +} + +func (c *LaunchConfiguration) Remove(_ context.Context) error { + params := &autoscaling.DeleteLaunchConfigurationInput{ + LaunchConfigurationName: c.name, + } + + _, err := c.svc.DeleteLaunchConfiguration(params) + if err != nil { + return err + } + + return nil +} + +func (c *LaunchConfiguration) String() string { + return *c.name +} diff --git a/resources/autoscaling-launchconfigurations.go b/resources/autoscaling-launchconfigurations.go deleted file mode 100644 index 36b312f51..000000000 --- a/resources/autoscaling-launchconfigurations.go +++ /dev/null @@ -1,55 +0,0 @@ -package resources - -import ( - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/autoscaling" -) - -func init() { - register("LaunchConfiguration", ListLaunchConfigurations) -} - -func ListLaunchConfigurations(s *session.Session) ([]Resource, error) { - resources := make([]Resource, 0) - svc := autoscaling.New(s) - - params := &autoscaling.DescribeLaunchConfigurationsInput{} - err := svc.DescribeLaunchConfigurationsPages(params, - func(page *autoscaling.DescribeLaunchConfigurationsOutput, lastPage bool) bool { - for _, launchconfig := range page.LaunchConfigurations { - resources = append(resources, &LaunchConfiguration{ - svc: svc, - name: launchconfig.LaunchConfigurationName, - }) - } - return !lastPage - }) - - if err != nil { - return nil, err - } - - return resources, nil -} - -type LaunchConfiguration struct { - svc *autoscaling.AutoScaling - name *string -} - -func (launchconfiguration *LaunchConfiguration) Remove() error { - params := &autoscaling.DeleteLaunchConfigurationInput{ - LaunchConfigurationName: launchconfiguration.name, - } - - _, err := launchconfiguration.svc.DeleteLaunchConfiguration(params) - if err != nil { - return err - } - - return nil -} - -func (launchconfiguration *LaunchConfiguration) String() string { - return *launchconfiguration.name -} diff --git a/resources/autoscaling-lifecyclehooks.go b/resources/autoscaling-lifecycle-hooks.go similarity index 64% rename from resources/autoscaling-lifecyclehooks.go rename to resources/autoscaling-lifecycle-hooks.go index fbc3facd1..c056d4a9e 100644 --- a/resources/autoscaling-lifecyclehooks.go +++ b/resources/autoscaling-lifecycle-hooks.go @@ -1,24 +1,40 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/autoscaling" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +// TODO: review if this should be prefixed with Autoscaling + +const LifecycleHookResource = "LifecycleHook" + func init() { - register("LifecycleHook", ListLifecycleHooks, - mapCloudControl("AWS::AutoScaling::LifecycleHook")) + resource.Register(resource.Registration{ + Name: LifecycleHookResource, + Scope: nuke.Account, + Lister: &LifecycleHookLister{}, + }) } -func ListLifecycleHooks(s *session.Session) ([]Resource, error) { - svc := autoscaling.New(s) +type LifecycleHookLister struct{} + +func (l *LifecycleHookLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := autoscaling.New(opts.Session) asgResp, err := svc.DescribeAutoScalingGroups(&autoscaling.DescribeAutoScalingGroupsInput{}) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, asg := range asgResp.AutoScalingGroups { lchResp, err := svc.DescribeLifecycleHooks(&autoscaling.DescribeLifecycleHooksInput{ AutoScalingGroupName: asg.AutoScalingGroupName, @@ -45,7 +61,7 @@ type LifecycleHook struct { autoScalingGroupName *string } -func (lch *LifecycleHook) Remove() error { +func (lch *LifecycleHook) Remove(_ context.Context) error { params := &autoscaling.DeleteLifecycleHookInput{ AutoScalingGroupName: lch.autoScalingGroupName, LifecycleHookName: lch.lifecycleHookName, diff --git a/resources/autoscalingplans-scalingplans.go b/resources/autoscalingplans-scalingplans.go index 17e9c328a..f354ba012 100644 --- a/resources/autoscalingplans-scalingplans.go +++ b/resources/autoscalingplans-scalingplans.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/autoscalingplans" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AutoScalingPlansScalingPlan struct { - svc *autoscalingplans.AutoScalingPlans - scalingPlanName *string - scalingPlanVersion *int64 -} +const AutoScalingPlansScalingPlanResource = "AutoScalingPlansScalingPlan" func init() { - register("AutoScalingPlansScalingPlan", ListAutoScalingPlansScalingPlans) + resource.Register(resource.Registration{ + Name: AutoScalingPlansScalingPlanResource, + Scope: nuke.Account, + Lister: &AutoScalingPlansScalingPlanLister{}, + }) } -func ListAutoScalingPlansScalingPlans(sess *session.Session) ([]Resource, error) { - svc := autoscalingplans.New(sess) +type AutoScalingPlansScalingPlanLister struct{} + +func (l *AutoScalingPlansScalingPlanLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := autoscalingplans.New(opts.Session) svc.ClientInfo.SigningName = "autoscaling-plans" - resources := []Resource{} + resources := make([]resource.Resource, 0) params := &autoscalingplans.DescribeScalingPlansInput{ MaxResults: aws.Int64(50), @@ -49,8 +58,13 @@ func ListAutoScalingPlansScalingPlans(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *AutoScalingPlansScalingPlan) Remove() error { +type AutoScalingPlansScalingPlan struct { + svc *autoscalingplans.AutoScalingPlans + scalingPlanName *string + scalingPlanVersion *int64 +} +func (f *AutoScalingPlansScalingPlan) Remove(_ context.Context) error { _, err := f.svc.DeleteScalingPlan(&autoscalingplans.DeleteScalingPlanInput{ ScalingPlanName: f.scalingPlanName, ScalingPlanVersion: f.scalingPlanVersion, diff --git a/resources/backup-plans.go b/resources/backup-plans.go index e44e52929..8985a97c4 100644 --- a/resources/backup-plans.go +++ b/resources/backup-plans.go @@ -1,11 +1,17 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/backup" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" "strings" + + "github.com/aws/aws-sdk-go/service/backup" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type BackupPlan struct { @@ -16,19 +22,29 @@ type BackupPlan struct { tags map[string]*string } +const AWSBackupPlanResource = "AWSBackupPlan" + func init() { - register("AWSBackupPlan", ListBackupPlans) + resource.Register(resource.Registration{ + Name: AWSBackupPlanResource, + Scope: nuke.Account, + Lister: &AWSBackupPlanLister{}, + }) } -func ListBackupPlans(sess *session.Session) ([]Resource, error) { - svc := backup.New(sess) +type AWSBackupPlanLister struct{} + +func (l *AWSBackupPlanLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := backup.New(opts.Session) falseValue := false maxBackupsLen := int64(100) params := &backup.ListBackupPlansInput{ IncludeDeleted: &falseValue, MaxResults: &maxBackupsLen, // aws default limit on number of backup plans per account } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { output, err := svc.ListBackupPlans(params) @@ -67,7 +83,7 @@ func (b *BackupPlan) Properties() types.Properties { return properties } -func (b *BackupPlan) Remove() error { +func (b *BackupPlan) Remove(_ context.Context) error { _, err := b.svc.DeleteBackupPlan(&backup.DeleteBackupPlanInput{ BackupPlanId: &b.id, }) diff --git a/resources/backup-recovery-points.go b/resources/backup-recovery-points.go index e948d6d60..c3f0f2664 100644 --- a/resources/backup-recovery-points.go +++ b/resources/backup-recovery-points.go @@ -1,10 +1,16 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/backup" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type BackupRecoveryPoint struct { @@ -13,22 +19,32 @@ type BackupRecoveryPoint struct { backupVaultName string } +const AWSBackupRecoveryPointResource = "AWSBackupRecoveryPoint" + func init() { - register("AWSBackupRecoveryPoint", ListBackupRecoveryPoints) + resource.Register(resource.Registration{ + Name: AWSBackupRecoveryPointResource, + Scope: nuke.Account, + Lister: &AWSBackupRecoveryPointLister{}, + }) } -func ListBackupRecoveryPoints(sess *session.Session) ([]Resource, error) { - svc := backup.New(sess) - max_vaults_len := int64(100) +type AWSBackupRecoveryPointLister struct{} + +func (l *AWSBackupRecoveryPointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := backup.New(opts.Session) + maxVaultsLen := int64(100) params := &backup.ListBackupVaultsInput{ - MaxResults: &max_vaults_len, // aws default limit on number of backup vaults per account + MaxResults: &maxVaultsLen, // aws default limit on number of backup vaults per account } resp, err := svc.ListBackupVaults(params) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.BackupVaultList { recoveryPointsOutput, _ := svc.ListRecoveryPointsByBackupVault(&backup.ListRecoveryPointsByBackupVaultInput{BackupVaultName: out.BackupVaultName}) for _, rp := range recoveryPointsOutput.RecoveryPoints { @@ -49,7 +65,7 @@ func (b *BackupRecoveryPoint) Properties() types.Properties { return properties } -func (b *BackupRecoveryPoint) Remove() error { +func (b *BackupRecoveryPoint) Remove(_ context.Context) error { _, err := b.svc.DeleteRecoveryPoint(&backup.DeleteRecoveryPointInput{ BackupVaultName: &b.backupVaultName, RecoveryPointArn: &b.arn, diff --git a/resources/backup-selections.go b/resources/backup-selections.go index aff71b40b..eb8ddb83e 100644 --- a/resources/backup-selections.go +++ b/resources/backup-selections.go @@ -1,11 +1,17 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/backup" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" "strings" + + "github.com/aws/aws-sdk-go/service/backup" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type BackupSelection struct { @@ -15,19 +21,29 @@ type BackupSelection struct { selectionName string } +const AWSBackupSelectionResource = "AWSBackupSelection" + func init() { - register("AWSBackupSelection", ListBackupSelections) + resource.Register(resource.Registration{ + Name: AWSBackupSelectionResource, + Scope: nuke.Account, + Lister: &AWSBackupSelectionLister{}, + }) } -func ListBackupSelections(sess *session.Session) ([]Resource, error) { - svc := backup.New(sess) - false_value := false - max_backups_len := int64(100) +type AWSBackupSelectionLister struct{} + +func (l *AWSBackupSelectionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := backup.New(opts.Session) + falseValue := false + maxBackupsLen := int64(100) params := &backup.ListBackupPlansInput{ - IncludeDeleted: &false_value, - MaxResults: &max_backups_len, // aws default limit on number of backup plans per account + IncludeDeleted: &falseValue, + MaxResults: &maxBackupsLen, // aws default limit on number of backup plans per account } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { output, err := svc.ListBackupPlans(params) @@ -65,7 +81,7 @@ func (b *BackupSelection) Properties() types.Properties { return properties } -func (b *BackupSelection) Remove() error { +func (b *BackupSelection) Remove(_ context.Context) error { _, err := b.svc.DeleteBackupSelection(&backup.DeleteBackupSelectionInput{ BackupPlanId: &b.planId, SelectionId: &b.selectionId, diff --git a/resources/backup-vaults-access-policies.go b/resources/backup-vaults-access-policies.go index 553efc662..51d499b3b 100644 --- a/resources/backup-vaults-access-policies.go +++ b/resources/backup-vaults-access-policies.go @@ -1,7 +1,11 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/aws/aws-sdk-go/service/backup" ) @@ -10,12 +14,22 @@ type BackupVaultAccessPolicy struct { backupVaultName string } +const AWSBackupVaultAccessPolicyResource = "AWSBackupVaultAccessPolicy" + func init() { - register("AWSBackupVaultAccessPolicy", ListBackupVaultAccessPolicies) + resource.Register(resource.Registration{ + Name: AWSBackupVaultAccessPolicyResource, + Scope: nuke.Account, + Lister: &AWSBackupVaultAccessPolicyLister{}, + }) } -func ListBackupVaultAccessPolicies(sess *session.Session) ([]Resource, error) { - svc := backup.New(sess) +type AWSBackupVaultAccessPolicyLister struct{} + +func (l *AWSBackupVaultAccessPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := backup.New(opts.Session) maxVaultsLen := int64(100) params := &backup.ListBackupVaultsInput{ MaxResults: &maxVaultsLen, // aws default limit on number of backup vaults per account @@ -26,7 +40,7 @@ func ListBackupVaultAccessPolicies(sess *session.Session) ([]Resource, error) { } // Iterate over backup vaults and add vault policies that exist. - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.BackupVaultList { // Check if the Backup Vault has an Access Policy set resp, err := svc.GetBackupVaultAccessPolicy(&backup.GetBackupVaultAccessPolicyInput{ @@ -57,7 +71,7 @@ func ListBackupVaultAccessPolicies(sess *session.Session) ([]Resource, error) { return resources, nil } -func (b *BackupVaultAccessPolicy) Remove() error { +func (b *BackupVaultAccessPolicy) Remove(_ context.Context) error { // Set the policy to a policy that allows deletion before removal. // // This is required to delete the policy for the automagically created vaults diff --git a/resources/backup-vaults.go b/resources/backup-vaults.go index d428c65e3..21a006b90 100644 --- a/resources/backup-vaults.go +++ b/resources/backup-vaults.go @@ -1,10 +1,16 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/backup" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type BackupVault struct { @@ -14,22 +20,32 @@ type BackupVault struct { tags map[string]*string } +const AWSBackupVaultResource = "AWSBackupVault" + func init() { - register("AWSBackupVault", ListBackupVaults) + resource.Register(resource.Registration{ + Name: AWSBackupVaultResource, + Scope: nuke.Account, + Lister: &AWSBackupVaultLister{}, + }) } -func ListBackupVaults(sess *session.Session) ([]Resource, error) { - svc := backup.New(sess) - max_vaults_len := int64(100) +type AWSBackupVaultLister struct{} + +func (l *AWSBackupVaultLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := backup.New(opts.Session) + maxVaultsLen := int64(100) params := &backup.ListBackupVaultsInput{ - MaxResults: &max_vaults_len, // aws default limit on number of backup vaults per account + MaxResults: &maxVaultsLen, // aws default limit on number of backup vaults per account } resp, err := svc.ListBackupVaults(params) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.BackupVaultList { tagsOutput, _ := svc.ListTags(&backup.ListTagsInput{ResourceArn: out.BackupVaultArn}) resources = append(resources, &BackupVault{ @@ -52,7 +68,7 @@ func (b *BackupVault) Properties() types.Properties { return properties } -func (b *BackupVault) Remove() error { +func (b *BackupVault) Remove(_ context.Context) error { _, err := b.svc.DeleteBackupVault(&backup.DeleteBackupVaultInput{ BackupVaultName: &b.name, }) diff --git a/resources/batch-computeenvironmentstates.go b/resources/batch-compute-environment-states.go similarity index 61% rename from resources/batch-computeenvironmentstates.go rename to resources/batch-compute-environment-states.go index cf867b16c..d1c0f0f49 100644 --- a/resources/batch-computeenvironmentstates.go +++ b/resources/batch-compute-environment-states.go @@ -1,27 +1,36 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/batch" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type BatchComputeEnvironmentState struct { - svc *batch.Batch - computeEnvironmentName *string - state *string -} +const BatchComputeEnvironmentStateResource = "BatchComputeEnvironmentState" func init() { - register("BatchComputeEnvironmentState", ListBatchComputeEnvironmentStates) + resource.Register(resource.Registration{ + Name: BatchComputeEnvironmentStateResource, + Scope: nuke.Account, + Lister: &BatchComputeEnvironmentStateLister{}, + }) } -func ListBatchComputeEnvironmentStates(sess *session.Session) ([]Resource, error) { - svc := batch.New(sess) - resources := []Resource{} +type BatchComputeEnvironmentStateLister struct{} + +func (l *BatchComputeEnvironmentStateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := batch.New(opts.Session) + resources := make([]resource.Resource, 0) params := &batch.DescribeComputeEnvironmentsInput{ MaxResults: aws.Int64(100), @@ -35,9 +44,9 @@ func ListBatchComputeEnvironmentStates(sess *session.Session) ([]Resource, error for _, computeEnvironment := range output.ComputeEnvironments { resources = append(resources, &BatchComputeEnvironmentState{ - svc: svc, + svc: svc, computeEnvironmentName: computeEnvironment.ComputeEnvironmentName, - state: computeEnvironment.State, + state: computeEnvironment.State, }) } @@ -51,8 +60,13 @@ func ListBatchComputeEnvironmentStates(sess *session.Session) ([]Resource, error return resources, nil } -func (f *BatchComputeEnvironmentState) Remove() error { +type BatchComputeEnvironmentState struct { + svc *batch.Batch + computeEnvironmentName *string + state *string +} +func (f *BatchComputeEnvironmentState) Remove(_ context.Context) error { _, err := f.svc.UpdateComputeEnvironment(&batch.UpdateComputeEnvironmentInput{ ComputeEnvironment: f.computeEnvironmentName, State: aws.String("DISABLED"), diff --git a/resources/batch-computeenvironments.go b/resources/batch-compute-environments.go similarity index 58% rename from resources/batch-computeenvironments.go rename to resources/batch-compute-environments.go index b9908d3e8..1ca3c99d3 100644 --- a/resources/batch-computeenvironments.go +++ b/resources/batch-compute-environments.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/batch" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type BatchComputeEnvironment struct { - svc *batch.Batch - computeEnvironmentName *string -} +const BatchComputeEnvironmentResource = "BatchComputeEnvironment" func init() { - register("BatchComputeEnvironment", ListBatchComputeEnvironments) + resource.Register(resource.Registration{ + Name: BatchComputeEnvironmentResource, + Scope: nuke.Account, + Lister: &BatchComputeEnvironmentLister{}, + }) } -func ListBatchComputeEnvironments(sess *session.Session) ([]Resource, error) { - svc := batch.New(sess) - resources := []Resource{} +type BatchComputeEnvironmentLister struct{} + +func (l *BatchComputeEnvironmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := batch.New(opts.Session) + resources := make([]resource.Resource, 0) params := &batch.DescribeComputeEnvironmentsInput{ MaxResults: aws.Int64(100), @@ -31,7 +41,7 @@ func ListBatchComputeEnvironments(sess *session.Session) ([]Resource, error) { for _, computeEnvironment := range output.ComputeEnvironments { resources = append(resources, &BatchComputeEnvironment{ - svc: svc, + svc: svc, computeEnvironmentName: computeEnvironment.ComputeEnvironmentName, }) } @@ -46,8 +56,12 @@ func ListBatchComputeEnvironments(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *BatchComputeEnvironment) Remove() error { +type BatchComputeEnvironment struct { + svc *batch.Batch + computeEnvironmentName *string +} +func (f *BatchComputeEnvironment) Remove(_ context.Context) error { _, err := f.svc.DeleteComputeEnvironment(&batch.DeleteComputeEnvironmentInput{ ComputeEnvironment: f.computeEnvironmentName, }) diff --git a/resources/batch-jobqueuestates.go b/resources/batch-job-queue-states.go similarity index 63% rename from resources/batch-jobqueuestates.go rename to resources/batch-job-queue-states.go index ed4e3044f..890e607d0 100644 --- a/resources/batch-jobqueuestates.go +++ b/resources/batch-job-queue-states.go @@ -1,12 +1,17 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/batch" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type BatchJobQueueState struct { @@ -15,13 +20,23 @@ type BatchJobQueueState struct { state *string } +const BatchJobQueueStateResource = "BatchJobQueueState" + func init() { - register("BatchJobQueueState", ListBatchJobQueueStates) + resource.Register(resource.Registration{ + Name: BatchJobQueueStateResource, + Scope: nuke.Account, + Lister: &BatchJobQueueStateLister{}, + }) } -func ListBatchJobQueueStates(sess *session.Session) ([]Resource, error) { - svc := batch.New(sess) - resources := []Resource{} +type BatchJobQueueStateLister struct{} + +func (l *BatchJobQueueStateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := batch.New(opts.Session) + resources := make([]resource.Resource, 0) params := &batch.DescribeJobQueuesInput{ MaxResults: aws.Int64(100), @@ -51,7 +66,7 @@ func ListBatchJobQueueStates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *BatchJobQueueState) Remove() error { +func (f *BatchJobQueueState) Remove(_ context.Context) error { _, err := f.svc.UpdateJobQueue(&batch.UpdateJobQueueInput{ JobQueue: f.jobQueue, diff --git a/resources/batch-jobqueues.go b/resources/batch-job-queues.go similarity index 58% rename from resources/batch-jobqueues.go rename to resources/batch-job-queues.go index e32bf94cd..3339dea7e 100644 --- a/resources/batch-jobqueues.go +++ b/resources/batch-job-queues.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/batch" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type BatchJobQueue struct { - svc *batch.Batch - jobQueue *string -} +const BatchJobQueueResource = "BatchJobQueue" func init() { - register("BatchJobQueue", ListBatchJobQueues) + resource.Register(resource.Registration{ + Name: BatchJobQueueResource, + Scope: nuke.Account, + Lister: &BatchJobQueueLister{}, + }) } -func ListBatchJobQueues(sess *session.Session) ([]Resource, error) { - svc := batch.New(sess) - resources := []Resource{} +type BatchJobQueueLister struct{} + +func (l *BatchJobQueueLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := batch.New(opts.Session) + resources := make([]resource.Resource, 0) params := &batch.DescribeJobQueuesInput{ MaxResults: aws.Int64(100), @@ -46,7 +56,12 @@ func ListBatchJobQueues(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *BatchJobQueue) Remove() error { +type BatchJobQueue struct { + svc *batch.Batch + jobQueue *string +} + +func (f *BatchJobQueue) Remove(_ context.Context) error { _, err := f.svc.DeleteJobQueue(&batch.DeleteJobQueueInput{ JobQueue: f.jobQueue, diff --git a/resources/billing-costandusagereports.go b/resources/billing-costandusagereports.go index b0148cbdf..e08431239 100644 --- a/resources/billing-costandusagereports.go +++ b/resources/billing-costandusagereports.go @@ -1,16 +1,29 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/costandusagereportservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const BillingCostandUsageReportResource = "BillingCostandUsageReport" + func init() { - register("BillingCostandUsageReport", ListBillingCostandUsageReports) + resource.Register(resource.Registration{ + Name: BillingCostandUsageReportResource, + Scope: nuke.Account, + Lister: &BillingCostandUsageReportLister{}, + }) } +type BillingCostandUsageReportLister struct{} + type BillingCostandUsageReport struct { svc *costandusagereportservice.CostandUsageReportService reportName *string @@ -19,8 +32,10 @@ type BillingCostandUsageReport struct { s3Region *string } -func ListBillingCostandUsageReports(sess *session.Session) ([]Resource, error) { - svc := costandusagereportservice.New(sess) +func (l *BillingCostandUsageReportLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := costandusagereportservice.New(opts.Session) params := &costandusagereportservice.DescribeReportDefinitionsInput{ MaxResults: aws.Int64(5), } @@ -36,21 +51,21 @@ func ListBillingCostandUsageReports(sess *session.Session) ([]Resource, error) { return nil, err } - resources := []Resource{} + resources := make([]resource.Resource, 0) for _, report := range reports { resources = append(resources, &BillingCostandUsageReport{ - svc: svc, - reportName: report.ReportName, - s3Bucket: report.S3Bucket, - s3Prefix: report.S3Prefix, - s3Region: report.S3Region, + svc: svc, + reportName: report.ReportName, + s3Bucket: report.S3Bucket, + s3Prefix: report.S3Prefix, + s3Region: report.S3Region, }) } return resources, nil } -func (r *BillingCostandUsageReport) Remove() error { +func (r *BillingCostandUsageReport) Remove(_ context.Context) error { _, err := r.svc.DeleteReportDefinition(&costandusagereportservice.DeleteReportDefinitionInput{ ReportName: r.reportName, }) diff --git a/resources/budgets.go b/resources/budgets.go index 1efd052e9..045a29f1f 100644 --- a/resources/budgets.go +++ b/resources/budgets.go @@ -1,30 +1,37 @@ package resources import ( - "fmt" + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/budgets" "github.com/aws/aws-sdk-go/service/sts" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const BudgetResource = "Budget" + func init() { - register("Budget", ListBudgets) + resource.Register(resource.Registration{ + Name: BudgetResource, + Scope: nuke.Account, + Lister: &BudgetLister{}, + }) } -type Budget struct { - svc *budgets.Budgets - name *string - budgetType *string - accountId *string -} +type BudgetLister struct{} -func ListBudgets(sess *session.Session) ([]Resource, error) { - svc := budgets.New(sess) +func (l *BudgetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := budgets.New(opts.Session) - identityOutput, err := sts.New(sess).GetCallerIdentity(nil) + // TODO: modify ListerOpts to include Account to reduce API calls + identityOutput, err := sts.New(opts.Session).GetCallerIdentity(nil) if err != nil { fmt.Printf("sts error: %s \n", err) return nil, err @@ -48,7 +55,7 @@ func ListBudgets(sess *session.Session) ([]Resource, error) { return nil, err } - resources := []Resource{} + var resources []resource.Resource for _, bud := range buds { resources = append(resources, &Budget{ svc: svc, @@ -61,7 +68,14 @@ func ListBudgets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (b *Budget) Remove() error { +type Budget struct { + svc *budgets.Budgets + name *string + budgetType *string + accountId *string +} + +func (b *Budget) Remove(_ context.Context) error { _, err := b.svc.DeleteBudget(&budgets.DeleteBudgetInput{ AccountId: b.accountId, diff --git a/resources/cloud9-environments.go b/resources/cloud9-environments.go index e92fdfb3f..a556a806c 100644 --- a/resources/cloud9-environments.go +++ b/resources/cloud9-environments.go @@ -1,9 +1,14 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloud9" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type Cloud9Environment struct { @@ -11,13 +16,23 @@ type Cloud9Environment struct { environmentID *string } +const Cloud9EnvironmentResource = "Cloud9Environment" + func init() { - register("Cloud9Environment", ListCloud9Environments) + resource.Register(resource.Registration{ + Name: Cloud9EnvironmentResource, + Scope: nuke.Account, + Lister: &Cloud9EnvironmentLister{}, + }) } -func ListCloud9Environments(sess *session.Session) ([]Resource, error) { - svc := cloud9.New(sess) - resources := []Resource{} +type Cloud9EnvironmentLister struct{} + +func (l *Cloud9EnvironmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloud9.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloud9.ListEnvironmentsInput{ MaxResults: aws.Int64(25), @@ -46,8 +61,7 @@ func ListCloud9Environments(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *Cloud9Environment) Remove() error { - +func (f *Cloud9Environment) Remove(_ context.Context) error { _, err := f.svc.DeleteEnvironment(&cloud9.DeleteEnvironmentInput{ EnvironmentId: f.environmentID, }) diff --git a/resources/cloudcontrol.go b/resources/cloudcontrol.go index 735d18a4b..c9737a768 100644 --- a/resources/cloudcontrol.go +++ b/resources/cloudcontrol.go @@ -1,16 +1,24 @@ package resources import ( + "context" + "encoding/json" "fmt" + "github.com/aws/aws-sdk-go/aws/awserr" + sdkerrors "github.com/ekristen/libnuke/pkg/errors" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cloudcontrolapi" "github.com/google/uuid" "github.com/pkg/errors" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" "github.com/sirupsen/logrus" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudcontrolapi" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) func init() { @@ -20,13 +28,16 @@ func init() { // // To get an overview of available cloud control resource types run this // command in the repo root: - // go run ./dev/list-cloudcontrol + // go run ./tools/list-cloudcontrol + // + // If there's a resource definition for the resource type, then there's no + // need to define it here as well, you should use the MapCloudControl func + // see ecr-public-repository.go for an example. registerCloudControl("AWS::AppFlow::ConnectorProfile") registerCloudControl("AWS::AppFlow::Flow") registerCloudControl("AWS::AppRunner::Service") registerCloudControl("AWS::ApplicationInsights::Application") registerCloudControl("AWS::Backup::Framework") - registerCloudControl("AWS::ECR::PublicRepository") registerCloudControl("AWS::ECR::PullThroughCacheRule") registerCloudControl("AWS::ECR::RegistryPolicy") registerCloudControl("AWS::ECR::ReplicationConfiguration") @@ -41,50 +52,71 @@ func init() { registerCloudControl("AWS::NetworkFirewall::RuleGroup") } -func NewListCloudControlResource(typeName string) func(*session.Session) ([]Resource, error) { - return func(sess *session.Session) ([]Resource, error) { - svc := cloudcontrolapi.New(sess) +func registerCloudControl(typeName string) { + resource.Register(resource.Registration{ + Name: typeName, + Scope: nuke.Account, + Lister: &CloudControlResourceLister{ + TypeName: typeName, + }, + }, nuke.MapCloudControl(typeName)) +} - params := &cloudcontrolapi.ListResourcesInput{ - TypeName: aws.String(typeName), - } - resources := make([]Resource, 0) - err := svc.ListResourcesPages(params, func(page *cloudcontrolapi.ListResourcesOutput, lastPage bool) bool { - for _, desc := range page.ResourceDescriptions { - identifier := aws.StringValue(desc.Identifier) +type CloudControlResourceLister struct { + TypeName string +} - properties, err := cloudControlParseProperties(aws.StringValue(desc.Properties)) - if err != nil { - logrus. - WithError(errors.WithStack(err)). - WithField("type-name", typeName). - WithField("identifier", identifier). - Error("failed to parse cloud control properties") - continue - } - properties = properties.Set("Identifier", identifier) - resources = append(resources, &CloudControlResource{ - svc: svc, - clientToken: uuid.New().String(), - typeName: typeName, - identifier: identifier, - properties: properties, - }) - } +func (l *CloudControlResourceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - return true - }) + svc := cloudcontrolapi.New(opts.Session) - if err != nil { - return nil, err + params := &cloudcontrolapi.ListResourcesInput{ + TypeName: aws.String(l.TypeName), + } + resources := make([]resource.Resource, 0) + if err := svc.ListResourcesPages(params, func(page *cloudcontrolapi.ListResourcesOutput, lastPage bool) bool { + for _, desc := range page.ResourceDescriptions { + identifier := aws.StringValue(desc.Identifier) + + properties, err := cloudControlParseProperties(aws.StringValue(desc.Properties)) + if err != nil { + logrus. + WithError(errors.WithStack(err)). + WithField("type-name", l.TypeName). + WithField("identifier", identifier). + Error("failed to parse cloud control properties") + continue + } + properties = properties.Set("Identifier", identifier) + resources = append(resources, &CloudControlResource{ + svc: svc, + clientToken: uuid.New().String(), + typeName: l.TypeName, + identifier: identifier, + properties: properties, + }) } - return resources, nil + return true + }); err != nil { + // If a Type is not available in a region we shouldn't throw an error for it. + var awsError awserr.Error + if errors.As(err, &awsError) { + if awsError.Code() == "TypeNotFoundException" { + return nil, sdkerrors.ErrSkipRequest( + "cloudformation type not available in region: " + *opts.Session.Config.Region) + } + } + + return nil, err } + + return resources, nil } func cloudControlParseProperties(payload string) (types.Properties, error) { - // Warning: The implementation of this function is not very straighforward, + // Warning: The implementation of this function is not very straightforward, // because the aws-nuke filter functions expect a very rigid structure and // the properties from the Cloud Control API are very dynamic. @@ -152,11 +184,11 @@ func (r *CloudControlResource) String() string { return r.identifier } -func (i *CloudControlResource) Remove() error { - _, err := i.svc.DeleteResource(&cloudcontrolapi.DeleteResourceInput{ - ClientToken: &i.clientToken, - Identifier: &i.identifier, - TypeName: &i.typeName, +func (r *CloudControlResource) Remove(_ context.Context) error { + _, err := r.svc.DeleteResource(&cloudcontrolapi.DeleteResourceInput{ + ClientToken: &r.clientToken, + Identifier: &r.identifier, + TypeName: &r.typeName, }) return err } diff --git a/resources/cloudcontrol_test.go b/resources/cloudcontrol_test.go index 7fc14ced2..8c24797c7 100644 --- a/resources/cloudcontrol_test.go +++ b/resources/cloudcontrol_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/sirupsen/logrus" - "github.com/stretchr/testify/require" + "github.com/stretchr/testify/assert" ) func TestCloudControlParseProperties(t *testing.T) { @@ -13,20 +13,29 @@ func TestCloudControlParseProperties(t *testing.T) { cases := []struct { name string payload string - want string + want []string }{ { name: "ActualEC2VPC", payload: `{"VpcId":"vpc-456","InstanceTenancy":"default","CidrBlockAssociations":["vpc-cidr-assoc-1234", "vpc-cidr-assoc-5678"],"CidrBlock":"10.10.0.0/16","Tags":[{"Value":"Kubernetes VPC","Key":"Name"}]}`, - want: `[CidrBlock: "10.10.0.0/16", CidrBlockAssociations.["vpc-cidr-assoc-1234"]: "true", CidrBlockAssociations.["vpc-cidr-assoc-5678"]: "true", InstanceTenancy: "default", Tags.["Name"]: "Kubernetes VPC", VpcId: "vpc-456"]`, + want: []string{ + `CidrBlock: "10.10.0.0/16"`, + `Tags.["Name"]: "Kubernetes VPC"`, + `VpcId: "vpc-456"`, + `InstanceTenancy: "default"`, + `CidrBlockAssociations.["vpc-cidr-assoc-1234"]: "true"`, + `CidrBlockAssociations.["vpc-cidr-assoc-5678"]: "true"`, + }, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { result, err := cloudControlParseProperties(tc.payload) - require.NoError(t, err) - require.Equal(t, tc.want, result.String()) + assert.NoError(t, err) + for _, w := range tc.want { + assert.Contains(t, result.String(), w) + } }) } } diff --git a/resources/clouddirectory-directories.go b/resources/clouddirectory-directories.go index 9562563fd..770597ebe 100644 --- a/resources/clouddirectory-directories.go +++ b/resources/clouddirectory-directories.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/clouddirectory" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudDirectoryDirectory struct { - svc *clouddirectory.CloudDirectory - directoryARN *string -} +const CloudDirectoryDirectoryResource = "CloudDirectoryDirectory" func init() { - register("CloudDirectoryDirectory", ListCloudDirectoryDirectories) + resource.Register(resource.Registration{ + Name: CloudDirectoryDirectoryResource, + Scope: nuke.Account, + Lister: &CloudDirectoryDirectoryLister{}, + }) } -func ListCloudDirectoryDirectories(sess *session.Session) ([]Resource, error) { - svc := clouddirectory.New(sess) - resources := []Resource{} +type CloudDirectoryDirectoryLister struct{} + +func (l *CloudDirectoryDirectoryLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := clouddirectory.New(opts.Session) + resources := make([]resource.Resource, 0) params := &clouddirectory.ListDirectoriesInput{ MaxResults: aws.Int64(30), @@ -47,7 +57,12 @@ func ListCloudDirectoryDirectories(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudDirectoryDirectory) Remove() error { +type CloudDirectoryDirectory struct { + svc *clouddirectory.CloudDirectory + directoryARN *string +} + +func (f *CloudDirectoryDirectory) Remove(_ context.Context) error { _, err := f.svc.DisableDirectory(&clouddirectory.DisableDirectoryInput{ DirectoryArn: f.directoryARN, diff --git a/resources/clouddirectory-schemas.go b/resources/clouddirectory-schemas.go index 8f36db427..72e41ade5 100644 --- a/resources/clouddirectory-schemas.go +++ b/resources/clouddirectory-schemas.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/clouddirectory" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudDirectorySchema struct { - svc *clouddirectory.CloudDirectory - schemaARN *string -} +const CloudDirectorySchemaResource = "CloudDirectorySchema" func init() { - register("CloudDirectorySchema", ListCloudDirectorySchemas) + resource.Register(resource.Registration{ + Name: CloudDirectorySchemaResource, + Scope: nuke.Account, + Lister: &CloudDirectorySchemaLister{}, + }) } -func ListCloudDirectorySchemas(sess *session.Session) ([]Resource, error) { - svc := clouddirectory.New(sess) - resources := []Resource{} +type CloudDirectorySchemaLister struct{} + +func (l *CloudDirectorySchemaLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := clouddirectory.New(opts.Session) + resources := make([]resource.Resource, 0) developmentParams := &clouddirectory.ListDevelopmentSchemaArnsInput{ MaxResults: aws.Int64(30), @@ -72,7 +82,12 @@ func ListCloudDirectorySchemas(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudDirectorySchema) Remove() error { +type CloudDirectorySchema struct { + svc *clouddirectory.CloudDirectory + schemaARN *string +} + +func (f *CloudDirectorySchema) Remove(_ context.Context) error { _, err := f.svc.DeleteSchema(&clouddirectory.DeleteSchemaInput{ SchemaArn: f.schemaARN, diff --git a/resources/cloudformation-stack.go b/resources/cloudformation-stack.go index ce194d646..f2cee74f1 100644 --- a/resources/cloudformation-stack.go +++ b/resources/cloudformation-stack.go @@ -1,31 +1,48 @@ package resources import ( + "context" + "errors" "strings" "time" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/cloudformation/cloudformationiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + liberrors "github.com/ekristen/libnuke/pkg/errors" + "github.com/ekristen/libnuke/pkg/featureflag" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -const CLOUDFORMATION_MAX_DELETE_ATTEMPT = 3 +const CloudformationMaxDeleteAttempt = 3 + +const CloudFormationStackResource = "CloudFormationStack" func init() { - register("CloudFormationStack", ListCloudFormationStacks) + resource.Register(resource.Registration{ + Name: CloudFormationStackResource, + Scope: nuke.Account, + Lister: &CloudFormationStackLister{}, + }) } -func ListCloudFormationStacks(sess *session.Session) ([]Resource, error) { - svc := cloudformation.New(sess) +type CloudFormationStackLister struct{} + +func (l *CloudFormationStackLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudformation.New(opts.Session) params := &cloudformation.DescribeStacksInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.DescribeStacks(params) @@ -33,13 +50,10 @@ func ListCloudFormationStacks(sess *session.Session) ([]Resource, error) { return nil, err } for _, stack := range resp.Stacks { - if aws.StringValue(stack.ParentId) != "" { - continue - } resources = append(resources, &CloudFormationStack{ svc: svc, stack: stack, - maxDeleteAttempts: CLOUDFORMATION_MAX_DELETE_ATTEMPT, + maxDeleteAttempts: CloudformationMaxDeleteAttempt, }) } @@ -57,24 +71,34 @@ type CloudFormationStack struct { svc cloudformationiface.CloudFormationAPI stack *cloudformation.Stack maxDeleteAttempts int - featureFlags config.FeatureFlags + featureFlags *featureflag.FeatureFlags } -func (cfs *CloudFormationStack) FeatureFlags(ff config.FeatureFlags) { +func (cfs *CloudFormationStack) FeatureFlags(ff *featureflag.FeatureFlags) { cfs.featureFlags = ff } -func (cfs *CloudFormationStack) Remove() error { +func (cfs *CloudFormationStack) Remove(_ context.Context) error { return cfs.removeWithAttempts(0) } func (cfs *CloudFormationStack) removeWithAttempts(attempt int) error { + ffddpCFS, err := cfs.featureFlags.Get("DisableDeletionProtection_CloudformationStack") + if err != nil { + return err + } + if err := cfs.doRemove(); err != nil { + // TODO: pass logrus in via ListerOpts so that it can be used here instead of global + logrus.Errorf("CloudFormationStack stackName=%s attempt=%d maxAttempts=%d delete failed: %s", *cfs.stack.StackName, attempt, cfs.maxDeleteAttempts, err.Error()) - awsErr, ok := err.(awserr.Error) + + var awsErr awserr.Error + ok := errors.As(err, &awsErr) if ok && awsErr.Code() == "ValidationError" && awsErr.Message() == "Stack ["+*cfs.stack.StackName+"] cannot be deleted while TerminationProtection is enabled" { - if cfs.featureFlags.DisableDeletionProtection.CloudformationStack { + + if ffddpCFS.Enabled() { logrus.Infof("CloudFormationStack stackName=%s attempt=%d maxAttempts=%d updating termination protection", *cfs.stack.StackName, attempt, cfs.maxDeleteAttempts) _, err = cfs.svc.UpdateTerminationProtection(&cloudformation.UpdateTerminationProtectionInput{ EnableTerminationProtection: aws.Bool(false), @@ -89,7 +113,7 @@ func (cfs *CloudFormationStack) removeWithAttempts(attempt int) error { } } if attempt >= cfs.maxDeleteAttempts { - return errors.New("CFS might not be deleted after this run.") + return errors.New("CFS might not be deleted after this run") } else { return cfs.removeWithAttempts(attempt + 1) } @@ -98,12 +122,39 @@ func (cfs *CloudFormationStack) removeWithAttempts(attempt int) error { } } +func GetParentStack(svc cloudformationiface.CloudFormationAPI, stackId string) (*cloudformation.Stack, error) { + o, err := svc.DescribeStacks(&cloudformation.DescribeStacksInput{}) + if err != nil { + return nil, err + } + + for _, o := range o.Stacks { + if *o.StackId == stackId { + return o, nil + } + } + + return nil, nil +} + func (cfs *CloudFormationStack) doRemove() error { + if cfs.stack.ParentId != nil { + p, err := GetParentStack(cfs.svc, *cfs.stack.ParentId) + if err != nil { + return err + } + + if p != nil { + return liberrors.ErrHoldResource("waiting for parent stack") + } + } + o, err := cfs.svc.DescribeStacks(&cloudformation.DescribeStacksInput{ StackName: cfs.stack.StackName, }) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { + var awsErr awserr.Error + if errors.As(err, &awsErr) { if awsErr.Code() == "ValidationFailed" && strings.HasSuffix(awsErr.Message(), " does not exist") { logrus.Infof("CloudFormationStack stackName=%s no longer exists", *cfs.stack.StackName) return nil @@ -123,7 +174,7 @@ func (cfs *CloudFormationStack) doRemove() error { }) } else if *stack.StackStatus == cloudformation.StackStatusDeleteFailed { logrus.Infof("CloudFormationStack stackName=%s delete failed. Attempting to retain and delete stack", *cfs.stack.StackName) - // This means the CFS has undeleteable resources. + // This means the CFS has undetectable resources. // In order to move on with nuking, we retain them in the deletion. retainableResources, err := cfs.svc.ListStackResources(&cloudformation.ListStackResourcesInput{ StackName: cfs.stack.StackName, diff --git a/resources/cloudformation-stack_test.go b/resources/cloudformation-stack_test.go index cd2619147..8825c682a 100644 --- a/resources/cloudformation-stack_test.go +++ b/resources/cloudformation-stack_test.go @@ -1,14 +1,20 @@ package resources import ( + "context" "testing" + "github.com/golang/mock/gomock" + "github.com/gotidy/ptr" + "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/cloudformation" - "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_cloudformationiface" - "github.com/stretchr/testify/assert" + + "github.com/ekristen/libnuke/pkg/featureflag" + + "github.com/ekristen/aws-nuke/mocks/mock_cloudformationiface" ) func TestCloudformationStack_Remove_StackAlreadyDeleted(t *testing.T) { @@ -23,8 +29,11 @@ func TestCloudformationStack_Remove_StackAlreadyDeleted(t *testing.T) { stack: &cloudformation.Stack{ StackName: aws.String("foobar"), }, + featureFlags: &featureflag.FeatureFlags{}, } + stack.featureFlags.New("DisableDeletionProtection_CloudformationStack", ptr.Bool(true), ptr.Bool(true)) + mockCloudformation.EXPECT().DescribeStacks(gomock.Eq(&cloudformation.DescribeStacksInput{ StackName: aws.String("foobar"), })).Return(&cloudformation.DescribeStacksOutput{ @@ -35,7 +44,7 @@ func TestCloudformationStack_Remove_StackAlreadyDeleted(t *testing.T) { }, }, nil) - err := stack.Remove() + err := stack.Remove(context.TODO()) a.Nil(err) } @@ -50,14 +59,16 @@ func TestCloudformationStack_Remove_StackDoesNotExist(t *testing.T) { svc: mockCloudformation, stack: &cloudformation.Stack{ StackName: aws.String("foobar"), - }, + }, featureFlags: &featureflag.FeatureFlags{}, } + stack.featureFlags.New("DisableDeletionProtection_CloudformationStack", ptr.Bool(true), ptr.Bool(true)) + mockCloudformation.EXPECT().DescribeStacks(gomock.Eq(&cloudformation.DescribeStacksInput{ StackName: aws.String("foobar"), })).Return(nil, awserr.New("ValidationFailed", "Stack with id foobar does not exist", nil)) - err := stack.Remove() + err := stack.Remove(context.TODO()) a.Nil(err) } @@ -73,8 +84,11 @@ func TestCloudformationStack_Remove_DeleteFailed(t *testing.T) { stack: &cloudformation.Stack{ StackName: aws.String("foobar"), }, + featureFlags: &featureflag.FeatureFlags{}, } + stack.featureFlags.New("DisableDeletionProtection_CloudformationStack", ptr.Bool(true), ptr.Bool(true)) + gomock.InOrder( mockCloudformation.EXPECT().DescribeStacks(gomock.Eq(&cloudformation.DescribeStacksInput{ StackName: aws.String("foobar"), @@ -110,7 +124,7 @@ func TestCloudformationStack_Remove_DeleteFailed(t *testing.T) { })).Return(nil), ) - err := stack.Remove() + err := stack.Remove(context.TODO()) a.Nil(err) } @@ -127,8 +141,11 @@ func TestCloudformationStack_Remove_DeleteInProgress(t *testing.T) { stack: &cloudformation.Stack{ StackName: aws.String("foobar"), }, + featureFlags: &featureflag.FeatureFlags{}, } + stack.featureFlags.New("DisableDeletionProtection_CloudformationStack", ptr.Bool(true), ptr.Bool(true)) + gomock.InOrder( mockCloudformation.EXPECT().DescribeStacks(gomock.Eq(&cloudformation.DescribeStacksInput{ StackName: aws.String("foobar"), @@ -145,7 +162,7 @@ func TestCloudformationStack_Remove_DeleteInProgress(t *testing.T) { })).Return(nil), ) - err := stack.Remove() + err := stack.Remove(context.TODO()) a.Nil(err) } @@ -174,8 +191,11 @@ func TestCloudformationStack_Remove_Stack_InCompletedStatus(t *testing.T) { stack: &cloudformation.Stack{ StackName: aws.String("foobar"), }, + featureFlags: &featureflag.FeatureFlags{}, } + stack.featureFlags.New("DisableDeletionProtection_CloudformationStack", ptr.Bool(true), ptr.Bool(true)) + gomock.InOrder( mockCloudformation.EXPECT().DescribeStacks(gomock.Eq(&cloudformation.DescribeStacksInput{ StackName: aws.String("foobar"), @@ -196,7 +216,7 @@ func TestCloudformationStack_Remove_Stack_InCompletedStatus(t *testing.T) { })).Return(nil), ) - err := stack.Remove() + err := stack.Remove(context.TODO()) a.Nil(err) }) } @@ -221,8 +241,11 @@ func TestCloudformationStack_Remove_Stack_CreateInProgress(t *testing.T) { stack: &cloudformation.Stack{ StackName: aws.String("foobar"), }, + featureFlags: &featureflag.FeatureFlags{}, } + stack.featureFlags.New("DisableDeletionProtection_CloudformationStack", ptr.Bool(true), ptr.Bool(true)) + gomock.InOrder( mockCloudformation.EXPECT().DescribeStacks(gomock.Eq(&cloudformation.DescribeStacksInput{ StackName: aws.String("foobar"), @@ -247,7 +270,7 @@ func TestCloudformationStack_Remove_Stack_CreateInProgress(t *testing.T) { })).Return(nil), ) - err := stack.Remove() + err := stack.Remove(context.TODO()) a.Nil(err) }) } @@ -273,8 +296,11 @@ func TestCloudformationStack_Remove_Stack_UpdateInProgress(t *testing.T) { stack: &cloudformation.Stack{ StackName: aws.String("foobar"), }, + featureFlags: &featureflag.FeatureFlags{}, } + stack.featureFlags.New("DisableDeletionProtection_CloudformationStack", ptr.Bool(true), ptr.Bool(true)) + gomock.InOrder( mockCloudformation.EXPECT().DescribeStacks(gomock.Eq(&cloudformation.DescribeStacksInput{ StackName: aws.String("foobar"), @@ -299,7 +325,7 @@ func TestCloudformationStack_Remove_Stack_UpdateInProgress(t *testing.T) { })).Return(nil), ) - err := stack.Remove() + err := stack.Remove(context.TODO()) a.Nil(err) }) } diff --git a/resources/cloudformation-stackset.go b/resources/cloudformation-stackset.go index d16318166..04f72e308 100644 --- a/resources/cloudformation-stackset.go +++ b/resources/cloudformation-stackset.go @@ -1,30 +1,44 @@ package resources import ( + "context" + + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" + "fmt" "strings" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/cloudformation/cloudformationiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "github.com/ekristen/libnuke/pkg/types" "github.com/sirupsen/logrus" ) +const CloudFormationStackSetResource = "CloudFormationStackSet" + func init() { - register("CloudFormationStackSet", ListCloudFormationStackSets, - mapCloudControl("AWS::CloudFormation::StackSet")) + resource.Register(resource.Registration{ + Name: CloudFormationStackSetResource, + Scope: nuke.Account, + Lister: &CloudFormationStackSetLister{}, + }) } -func ListCloudFormationStackSets(sess *session.Session) ([]Resource, error) { - svc := cloudformation.New(sess) +type CloudFormationStackSetLister struct{} + +func (l *CloudFormationStackSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudformation.New(opts.Session) params := &cloudformation.ListStackSetsInput{ Status: aws.String(cloudformation.StackSetStatusActive), } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListStackSets(params) @@ -132,7 +146,7 @@ func (cfs *CloudFormationStackSet) deleteStackInstances(accountId string, region return cfs.waitForStackSetOperation(*result.OperationId) } -func (cfs *CloudFormationStackSet) Remove() error { +func (cfs *CloudFormationStackSet) Remove(_ context.Context) error { accounts, err := cfs.findStackInstances() if err != nil { return err diff --git a/resources/cloudformation-stackset_test.go b/resources/cloudformation-stackset_test.go index 26f139688..f07e57989 100644 --- a/resources/cloudformation-stackset_test.go +++ b/resources/cloudformation-stackset_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_cloudformationiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudformation" + + "github.com/ekristen/aws-nuke/mocks/mock_cloudformationiface" ) func TestCloudformationStackSet_Remove(t *testing.T) { @@ -70,7 +73,7 @@ func TestCloudformationStackSet_Remove(t *testing.T) { StackSetName: aws.String("foobar"), })).Return(&cloudformation.DeleteStackSetOutput{}, nil) - err := stackSet.Remove() + err := stackSet.Remove(context.TODO()) a.Nil(err) } @@ -145,7 +148,7 @@ func TestCloudformationStackSet_Remove_MultipleAccounts(t *testing.T) { StackSetName: aws.String("foobar"), })).Return(&cloudformation.DeleteStackSetOutput{}, nil) - err := stackSet.Remove() + err := stackSet.Remove(context.TODO()) a.Nil(err) } @@ -192,6 +195,6 @@ func TestCloudformationStackSet_Remove_DeleteStackInstanceFailed(t *testing.T) { }, }, nil) - err := stackSet.Remove() + err := stackSet.Remove(context.TODO()) a.EqualError(err, "unable to delete stackSet=foobar operationId=o1 status=FAILED") } diff --git a/resources/cloudformation-type.go b/resources/cloudformation-type.go index 4c43eb4b1..3c349c0fc 100644 --- a/resources/cloudformation-type.go +++ b/resources/cloudformation-type.go @@ -1,23 +1,40 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/cloudformation/cloudformationiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const CloudFormationTypeResource = "CloudFormationType" + func init() { - register("CloudFormationType", ListCloudFormationTypes) + resource.Register(resource.Registration{ + Name: CloudFormationTypeResource, + Scope: nuke.Account, + Lister: &CloudFormationTypeLister{}, + }) } -func ListCloudFormationTypes(sess *session.Session) ([]Resource, error) { - svc := cloudformation.New(sess) +type CloudFormationTypeLister struct{} + +func (l *CloudFormationTypeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudformation.New(opts.Session) params := &cloudformation.ListTypesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListTypes(params) @@ -67,7 +84,7 @@ func (cfs *CloudFormationType) findAllVersionSummaries() ([]*cloudformation.Type } } -func (cfs *CloudFormationType) Remove() error { +func (cfs *CloudFormationType) Remove(_ context.Context) error { typeVersionSummaries, loadErr := cfs.findAllVersionSummaries() if loadErr != nil { return loadErr @@ -91,7 +108,7 @@ func (cfs *CloudFormationType) Remove() error { } if failed { - return fmt.Errorf("Unable to remove all CloudFormationType versions arn=%s", *cfs.typeSummary.TypeArn) + return fmt.Errorf("unable to remove all CloudFormationType versions arn=%s", *cfs.typeSummary.TypeArn) } _, err := cfs.svc.DeregisterType(&cloudformation.DeregisterTypeInput{ diff --git a/resources/cloudformation-type_test.go b/resources/cloudformation-type_test.go index 6074cbc53..67b6ded09 100644 --- a/resources/cloudformation-type_test.go +++ b/resources/cloudformation-type_test.go @@ -1,13 +1,15 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_cloudformationiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudformation" + "github.com/ekristen/aws-nuke/mocks/mock_cloudformationiface" ) func TestCloudformationType_Remove(t *testing.T) { @@ -60,7 +62,6 @@ func TestCloudformationType_Remove(t *testing.T) { Arn: aws.String("foobar"), }) - err := cfnType.Remove() + err := cfnType.Remove(context.TODO()) a.Nil(err) - } diff --git a/resources/cloudfront-distributiondeployments.go b/resources/cloudfront-distribution-deployments.go similarity index 67% rename from resources/cloudfront-distributiondeployments.go rename to resources/cloudfront-distribution-deployments.go index 168f0acb4..9507ed6f9 100644 --- a/resources/cloudfront-distributiondeployments.go +++ b/resources/cloudfront-distribution-deployments.go @@ -1,11 +1,16 @@ package resources import ( + "context" + "fmt" + "github.com/gotidy/ptr" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudfront" + + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) type CloudFrontDistributionDeployment struct { @@ -16,14 +21,24 @@ type CloudFrontDistributionDeployment struct { status string } +const CloudFrontDistributionDeploymentResource = "CloudFrontDistributionDeployment" + func init() { - register("CloudFrontDistributionDeployment", ListCloudFrontDistributionDeployments) + resource.Register(resource.Registration{ + Name: CloudFrontDistributionDeploymentResource, + Scope: nuke.Account, + Lister: &CloudFrontDistributionDeploymentLister{}, + }) } -func ListCloudFrontDistributionDeployments(sess *session.Session) ([]Resource, error) { - svc := cloudfront.New(sess) - resources := []Resource{} - distributions := []*cloudfront.DistributionSummary{} +type CloudFrontDistributionDeploymentLister struct{} + +func (l *CloudFrontDistributionDeploymentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudfront.New(opts.Session) + resources := make([]resource.Resource, 0) + var distributions []*cloudfront.DistributionSummary params := &cloudfront.ListDistributionsInput{ MaxItems: aws.Int64(25), @@ -59,15 +74,14 @@ func ListCloudFrontDistributionDeployments(sess *session.Session) ([]Resource, e distributionID: resp.Distribution.Id, eTag: resp.ETag, distributionConfig: resp.Distribution.DistributionConfig, - status: UnPtrString(resp.Distribution.Status, "unknown"), + status: ptr.ToString(resp.Distribution.Status), }) } return resources, nil } -func (f *CloudFrontDistributionDeployment) Remove() error { - +func (f *CloudFrontDistributionDeployment) Remove(_ context.Context) error { f.distributionConfig.Enabled = aws.Bool(false) _, err := f.svc.UpdateDistribution(&cloudfront.UpdateDistributionInput{ diff --git a/resources/cloudfront-distributions.go b/resources/cloudfront-distributions.go index a85cee29e..69e584509 100644 --- a/resources/cloudfront-distributions.go +++ b/resources/cloudfront-distributions.go @@ -1,29 +1,39 @@ package resources import ( + "context" + "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudfront" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudFrontDistribution struct { - svc *cloudfront.CloudFront - ID *string - status *string - lastModifiedTime *time.Time - tags []*cloudfront.Tag -} +const CloudFrontDistributionResource = "CloudFrontDistribution" func init() { - register("CloudFrontDistribution", ListCloudFrontDistributions) + resource.Register(resource.Registration{ + Name: CloudFrontDistributionResource, + Scope: nuke.Account, + Lister: &CloudFrontDistributionLister{}, + DependsOn: []string{ + CloudFrontDistributionDeploymentResource, + }, + }) } -func ListCloudFrontDistributions(sess *session.Session) ([]Resource, error) { - svc := cloudfront.New(sess) - resources := []Resource{} +type CloudFrontDistributionLister struct{} + +func (l *CloudFrontDistributionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudfront.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudfront.ListDistributionsInput{ MaxItems: aws.Int64(25), @@ -62,6 +72,14 @@ func ListCloudFrontDistributions(sess *session.Session) ([]Resource, error) { return resources, nil } +type CloudFrontDistribution struct { + svc *cloudfront.CloudFront + ID *string + status *string + lastModifiedTime *time.Time + tags []*cloudfront.Tag +} + func (f *CloudFrontDistribution) Properties() types.Properties { properties := types.NewProperties(). Set("LastModifiedTime", f.lastModifiedTime.Format(time.RFC3339)) @@ -72,8 +90,7 @@ func (f *CloudFrontDistribution) Properties() types.Properties { return properties } -func (f *CloudFrontDistribution) Remove() error { - +func (f *CloudFrontDistribution) Remove(_ context.Context) error { // Get Existing eTag resp, err := f.svc.GetDistributionConfig(&cloudfront.GetDistributionConfigInput{ Id: f.ID, diff --git a/resources/cloudfront-function.go b/resources/cloudfront-function.go index 3be06d6fc..0037f7dc5 100644 --- a/resources/cloudfront-function.go +++ b/resources/cloudfront-function.go @@ -1,24 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/cloudfront" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudFrontFunction struct { - svc *cloudfront.CloudFront - name *string - stage *string -} +const CloudFrontFunctionResource = "CloudFrontFunction" func init() { - register("CloudFrontFunction", ListCloudFrontFunctions) + resource.Register(resource.Registration{ + Name: CloudFrontFunctionResource, + Scope: nuke.Account, + Lister: &CloudFrontFunctionLister{}, + }) } -func ListCloudFrontFunctions(sess *session.Session) ([]Resource, error) { - svc := cloudfront.New(sess) - resources := []Resource{} +type CloudFrontFunctionLister struct{} + +func (l *CloudFrontFunctionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudfront.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudfront.ListFunctionsInput{} for { @@ -45,7 +54,13 @@ func ListCloudFrontFunctions(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudFrontFunction) Remove() error { +type CloudFrontFunction struct { + svc *cloudfront.CloudFront + name *string + stage *string +} + +func (f *CloudFrontFunction) Remove(_ context.Context) error { resp, err := f.svc.GetFunction(&cloudfront.GetFunctionInput{ Name: f.name, Stage: f.stage, diff --git a/resources/cloudfront-origin-access-control.go b/resources/cloudfront-origin-access-control.go index 7ff6262f8..4fb4bb82a 100644 --- a/resources/cloudfront-origin-access-control.go +++ b/resources/cloudfront-origin-access-control.go @@ -1,23 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/cloudfront" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudFrontOriginAccessControl struct { - svc *cloudfront.CloudFront - ID *string -} +const CloudFrontOriginAccessControlResource = "CloudFrontOriginAccessControl" func init() { - register("CloudFrontOriginAccessControl", ListCloudFrontOriginAccessControls) + resource.Register(resource.Registration{ + Name: CloudFrontOriginAccessControlResource, + Scope: nuke.Account, + Lister: &CloudFrontOriginAccessControlLister{}, + }) } -func ListCloudFrontOriginAccessControls(sess *session.Session) ([]Resource, error) { - svc := cloudfront.New(sess) - resources := []Resource{} +type CloudFrontOriginAccessControlLister struct{} + +func (l *CloudFrontOriginAccessControlLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudfront.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudfront.ListOriginAccessControlsInput{} for { @@ -43,7 +53,12 @@ func ListCloudFrontOriginAccessControls(sess *session.Session) ([]Resource, erro return resources, nil } -func (f *CloudFrontOriginAccessControl) Remove() error { +type CloudFrontOriginAccessControl struct { + svc *cloudfront.CloudFront + ID *string +} + +func (f *CloudFrontOriginAccessControl) Remove(_ context.Context) error { resp, err := f.svc.GetOriginAccessControl(&cloudfront.GetOriginAccessControlInput{ Id: f.ID, }) diff --git a/resources/cloudfront-origin-access-identities.go b/resources/cloudfront-origin-access-identities.go index 375121f60..2c071a5d3 100644 --- a/resources/cloudfront-origin-access-identities.go +++ b/resources/cloudfront-origin-access-identities.go @@ -1,58 +1,73 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cloudfront" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "context" + + "github.com/aws/aws-sdk-go/service/cloudfront" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudFrontOriginAccessIdentity struct { - svc *cloudfront.CloudFront - ID *string -} +const CloudFrontOriginAccessIdentityResource = "CloudFrontOriginAccessIdentity" func init() { - register("CloudFrontOriginAccessIdentity", ListCloudFrontOriginAccessIdentities) + resource.Register(resource.Registration{ + Name: CloudFrontOriginAccessIdentityResource, + Scope: nuke.Account, + Lister: &CloudFrontOriginAccessIdentityLister{}, + }) +} + +type CloudFrontOriginAccessIdentityLister struct{} + +func (l *CloudFrontOriginAccessIdentityLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudfront.New(opts.Session) + resources := make([]resource.Resource, 0) + + for { + resp, err := svc.ListCloudFrontOriginAccessIdentities(nil) + if err != nil { + return nil, err + } + + for _, item := range resp.CloudFrontOriginAccessIdentityList.Items { + resources = append(resources, &CloudFrontOriginAccessIdentity{ + svc: svc, + ID: item.Id, + }) + } + return resources, nil + } } -func ListCloudFrontOriginAccessIdentities(sess *session.Session) ([]Resource, error) { - svc := cloudfront.New(sess) - resources := []Resource{} - - for { - resp, err := svc.ListCloudFrontOriginAccessIdentities(nil) - if err != nil { - return nil, err - } - - for _, item := range resp.CloudFrontOriginAccessIdentityList.Items { - resources = append(resources,&CloudFrontOriginAccessIdentity{ - svc: svc, - ID: item.Id, - }) - } - return resources, nil - } +type CloudFrontOriginAccessIdentity struct { + svc *cloudfront.CloudFront + ID *string } -func (f *CloudFrontOriginAccessIdentity) Remove() error { - resp, err := f.svc.GetCloudFrontOriginAccessIdentity(&cloudfront.GetCloudFrontOriginAccessIdentityInput{ - Id: f.ID, - }) - if err != nil { - return err - } +func (f *CloudFrontOriginAccessIdentity) Remove(_ context.Context) error { + resp, err := f.svc.GetCloudFrontOriginAccessIdentity(&cloudfront.GetCloudFrontOriginAccessIdentityInput{ + Id: f.ID, + }) + if err != nil { + return err + } - _, err = f.svc.DeleteCloudFrontOriginAccessIdentity(&cloudfront.DeleteCloudFrontOriginAccessIdentityInput{ - Id: f.ID, - IfMatch: resp.ETag, - }) + _, err = f.svc.DeleteCloudFrontOriginAccessIdentity(&cloudfront.DeleteCloudFrontOriginAccessIdentityInput{ + Id: f.ID, + IfMatch: resp.ETag, + }) - return err + return err } func (f *CloudFrontOriginAccessIdentity) Properties() types.Properties { - properties := types.NewProperties() - properties.Set("ID", f.ID) - return properties + properties := types.NewProperties() + properties.Set("ID", f.ID) + return properties } diff --git a/resources/cloudhsmv2-cluster.go b/resources/cloudhsmv2-cluster.go index 2e03d0eec..557f8b47e 100644 --- a/resources/cloudhsmv2-cluster.go +++ b/resources/cloudhsmv2-cluster.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudhsmv2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudHSMV2Cluster struct { - svc *cloudhsmv2.CloudHSMV2 - clusterID *string -} +const CloudHSMV2ClusterResource = "CloudHSMV2Cluster" func init() { - register("CloudHSMV2Cluster", ListCloudHSMV2Clusters) + resource.Register(resource.Registration{ + Name: CloudHSMV2ClusterResource, + Scope: nuke.Account, + Lister: &CloudHSMV2ClusterLister{}, + }) } -func ListCloudHSMV2Clusters(sess *session.Session) ([]Resource, error) { - svc := cloudhsmv2.New(sess) - resources := []Resource{} +type CloudHSMV2ClusterLister struct{} + +func (l *CloudHSMV2ClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudhsmv2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudhsmv2.DescribeClustersInput{ MaxResults: aws.Int64(25), @@ -46,8 +56,12 @@ func ListCloudHSMV2Clusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudHSMV2Cluster) Remove() error { +type CloudHSMV2Cluster struct { + svc *cloudhsmv2.CloudHSMV2 + clusterID *string +} +func (f *CloudHSMV2Cluster) Remove(_ context.Context) error { _, err := f.svc.DeleteCluster(&cloudhsmv2.DeleteClusterInput{ ClusterId: f.clusterID, }) diff --git a/resources/cloudhsmv2-clusterhsms.go b/resources/cloudhsmv2-clusterhsms.go index b2e12491c..1f6b7cdf2 100644 --- a/resources/cloudhsmv2-clusterhsms.go +++ b/resources/cloudhsmv2-clusterhsms.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudhsmv2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudHSMV2ClusterHSM struct { - svc *cloudhsmv2.CloudHSMV2 - clusterID *string - hsmID *string -} +const CloudHSMV2ClusterHSMResource = "CloudHSMV2ClusterHSM" func init() { - register("CloudHSMV2ClusterHSM", ListCloudHSMV2ClusterHSMs) + resource.Register(resource.Registration{ + Name: CloudHSMV2ClusterHSMResource, + Scope: nuke.Account, + Lister: &CloudHSMV2ClusterHSMLister{}, + }) } -func ListCloudHSMV2ClusterHSMs(sess *session.Session) ([]Resource, error) { - svc := cloudhsmv2.New(sess) - resources := []Resource{} +type CloudHSMV2ClusterHSMLister struct{} + +func (l *CloudHSMV2ClusterHSMLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudhsmv2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudhsmv2.DescribeClustersInput{ MaxResults: aws.Int64(25), @@ -51,8 +60,13 @@ func ListCloudHSMV2ClusterHSMs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudHSMV2ClusterHSM) Remove() error { +type CloudHSMV2ClusterHSM struct { + svc *cloudhsmv2.CloudHSMV2 + clusterID *string + hsmID *string +} +func (f *CloudHSMV2ClusterHSM) Remove(_ context.Context) error { _, err := f.svc.DeleteHsm(&cloudhsmv2.DeleteHsmInput{ ClusterId: f.clusterID, HsmId: f.hsmID, diff --git a/resources/cloudsearch-domains.go b/resources/cloudsearch-domains.go index 7d718ecf5..c7b676ed1 100644 --- a/resources/cloudsearch-domains.go +++ b/resources/cloudsearch-domains.go @@ -1,21 +1,31 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/cloudsearch" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudSearchDomain struct { - svc *cloudsearch.CloudSearch - domainName *string -} +const CloudSearchDomainResource = "CloudSearchDomain" func init() { - register("CloudSearchDomain", ListCloudSearchDomains) + resource.Register(resource.Registration{ + Name: CloudSearchDomainResource, + Scope: nuke.Account, + Lister: &CloudSearchDomainLister{}, + }) } -func ListCloudSearchDomains(sess *session.Session) ([]Resource, error) { - svc := cloudsearch.New(sess) +type CloudSearchDomainLister struct{} + +func (l *CloudSearchDomainLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudsearch.New(opts.Session) params := &cloudsearch.DescribeDomainsInput{} @@ -24,7 +34,7 @@ func ListCloudSearchDomains(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, domain := range resp.DomainStatusList { resources = append(resources, &CloudSearchDomain{ svc: svc, @@ -34,8 +44,12 @@ func ListCloudSearchDomains(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudSearchDomain) Remove() error { +type CloudSearchDomain struct { + svc *cloudsearch.CloudSearch + domainName *string +} +func (f *CloudSearchDomain) Remove(_ context.Context) error { _, err := f.svc.DeleteDomain(&cloudsearch.DeleteDomainInput{ DomainName: f.domainName, }) diff --git a/resources/cloudtrail-trails.go b/resources/cloudtrail-trails.go index 3f6c12978..5164f2e79 100644 --- a/resources/cloudtrail-trails.go +++ b/resources/cloudtrail-trails.go @@ -1,23 +1,38 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/cloudtrail" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const CloudTrailTrailResource = "CloudTrailTrail" + func init() { - register("CloudTrailTrail", ListCloudTrailTrails) + resource.Register(resource.Registration{ + Name: CloudTrailTrailResource, + Scope: nuke.Account, + Lister: &CloudTrailTrailLister{}, + }) } -func ListCloudTrailTrails(sess *session.Session) ([]Resource, error) { - svc := cloudtrail.New(sess) +type CloudTrailTrailLister struct{} + +func (l *CloudTrailTrailLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudtrail.New(opts.Session) resp, err := svc.DescribeTrails(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, trail := range resp.TrailList { resources = append(resources, &CloudTrailTrail{ svc: svc, @@ -33,7 +48,7 @@ type CloudTrailTrail struct { name *string } -func (trail *CloudTrailTrail) Remove() error { +func (trail *CloudTrailTrail) Remove(_ context.Context) error { _, err := trail.svc.DeleteTrail(&cloudtrail.DeleteTrailInput{ Name: trail.name, }) diff --git a/resources/cloudwatch-alarms.go b/resources/cloudwatch-alarms.go index 55fa2d839..fe695c501 100644 --- a/resources/cloudwatch-alarms.go +++ b/resources/cloudwatch-alarms.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatch" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudWatchAlarm struct { - svc *cloudwatch.CloudWatch - alarmName *string - tags []*cloudwatch.Tag -} +const CloudWatchAlarmResource = "CloudWatchAlarm" func init() { - register("CloudWatchAlarm", ListCloudWatchAlarms) + resource.Register(resource.Registration{ + Name: CloudWatchAlarmResource, + Scope: nuke.Account, + Lister: &CloudWatchAlarmLister{}, + }) } -func ListCloudWatchAlarms(sess *session.Session) ([]Resource, error) { - svc := cloudwatch.New(sess) - resources := []Resource{} +type CloudWatchAlarmLister struct{} + +func (l *CloudWatchAlarmLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatch.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudwatch.DescribeAlarmsInput{ MaxRecords: aws.Int64(100), @@ -62,8 +71,13 @@ func GetAlarmTags(svc *cloudwatch.CloudWatch, arn *string) ([]*cloudwatch.Tag, e return resp.Tags, nil } -func (f *CloudWatchAlarm) Remove() error { +type CloudWatchAlarm struct { + svc *cloudwatch.CloudWatch + alarmName *string + tags []*cloudwatch.Tag +} +func (f *CloudWatchAlarm) Remove(_ context.Context) error { _, err := f.svc.DeleteAlarms(&cloudwatch.DeleteAlarmsInput{ AlarmNames: []*string{f.alarmName}, }) diff --git a/resources/cloudwatch-dashboards.go b/resources/cloudwatch-dashboards.go index a2e20bebf..f63ff4c49 100644 --- a/resources/cloudwatch-dashboards.go +++ b/resources/cloudwatch-dashboards.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/cloudwatch" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudWatchDashboard struct { - svc *cloudwatch.CloudWatch - dashboardName *string -} +const CloudWatchDashboardResource = "CloudWatchDashboard" func init() { - register("CloudWatchDashboard", ListCloudWatchDashboards) + resource.Register(resource.Registration{ + Name: CloudWatchDashboardResource, + Scope: nuke.Account, + Lister: &CloudWatchDashboardLister{}, + }) } -func ListCloudWatchDashboards(sess *session.Session) ([]Resource, error) { - svc := cloudwatch.New(sess) - resources := []Resource{} +type CloudWatchDashboardLister struct{} + +func (l *CloudWatchDashboardLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatch.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudwatch.ListDashboardsInput{} @@ -43,8 +53,12 @@ func ListCloudWatchDashboards(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudWatchDashboard) Remove() error { +type CloudWatchDashboard struct { + svc *cloudwatch.CloudWatch + dashboardName *string +} +func (f *CloudWatchDashboard) Remove(_ context.Context) error { _, err := f.svc.DeleteDashboards(&cloudwatch.DeleteDashboardsInput{ DashboardNames: []*string{f.dashboardName}, }) diff --git a/resources/cloudwatchevents-buses.go b/resources/cloudwatchevents-buses.go index b4c3d8a1a..e4a6ace58 100644 --- a/resources/cloudwatchevents-buses.go +++ b/resources/cloudwatchevents-buses.go @@ -1,23 +1,38 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const CloudWatchEventsBusesResource = "CloudWatchEventsBuses" + func init() { - register("CloudWatchEventsBuses", ListCloudWatchEventsBuses) + resource.Register(resource.Registration{ + Name: CloudWatchEventsBusesResource, + Scope: nuke.Account, + Lister: &CloudWatchEventsBusesLister{}, + }) } -func ListCloudWatchEventsBuses(sess *session.Session) ([]Resource, error) { - svc := cloudwatchevents.New(sess) +type CloudWatchEventsBusesLister struct{} + +func (l *CloudWatchEventsBusesLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatchevents.New(opts.Session) resp, err := svc.ListEventBuses(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, bus := range resp.EventBuses { if *bus.Name == "default" { continue @@ -36,7 +51,7 @@ type CloudWatchEventsBus struct { name *string } -func (bus *CloudWatchEventsBus) Remove() error { +func (bus *CloudWatchEventsBus) Remove(_ context.Context) error { _, err := bus.svc.DeleteEventBus(&cloudwatchevents.DeleteEventBusInput{ Name: bus.name, }) diff --git a/resources/cloudwatchevents-rules.go b/resources/cloudwatchevents-rules.go index 3b6caeb98..f14e6c1af 100644 --- a/resources/cloudwatchevents-rules.go +++ b/resources/cloudwatchevents-rules.go @@ -1,26 +1,41 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatchevents" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const CloudWatchEventsRuleResource = "CloudWatchEventsRule" + func init() { - register("CloudWatchEventsRule", ListCloudWatchEventsRules) + resource.Register(resource.Registration{ + Name: CloudWatchEventsRuleResource, + Scope: nuke.Account, + Lister: &CloudWatchEventsRuleLister{}, + }) } -func ListCloudWatchEventsRules(sess *session.Session) ([]Resource, error) { - svc := cloudwatchevents.New(sess) +type CloudWatchEventsRuleLister struct{} + +func (l *CloudWatchEventsRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatchevents.New(opts.Session) resp, err := svc.ListEventBuses(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, bus := range resp.EventBuses { resp, err := svc.ListRules(&cloudwatchevents.ListRulesInput{ EventBusName: bus.Name, @@ -46,7 +61,7 @@ type CloudWatchEventsRule struct { busName *string } -func (rule *CloudWatchEventsRule) Remove() error { +func (rule *CloudWatchEventsRule) Remove(_ context.Context) error { _, err := rule.svc.DeleteRule(&cloudwatchevents.DeleteRuleInput{ Name: rule.name, EventBusName: rule.busName, @@ -56,5 +71,6 @@ func (rule *CloudWatchEventsRule) Remove() error { } func (rule *CloudWatchEventsRule) String() string { + // TODO: remove Rule:, mark as breaking change for filters return fmt.Sprintf("Rule: %s", *rule.name) } diff --git a/resources/cloudwatchevents-targets.go b/resources/cloudwatchevents-targets.go index 2d95a665f..e622fc693 100644 --- a/resources/cloudwatchevents-targets.go +++ b/resources/cloudwatchevents-targets.go @@ -1,26 +1,41 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatchevents" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const CloudWatchEventsTargetResource = "CloudWatchEventsTarget" + func init() { - register("CloudWatchEventsTarget", ListCloudWatchEventsTargets) + resource.Register(resource.Registration{ + Name: CloudWatchEventsTargetResource, + Scope: nuke.Account, + Lister: &CloudWatchEventsTargetLister{}, + }) } -func ListCloudWatchEventsTargets(sess *session.Session) ([]Resource, error) { - svc := cloudwatchevents.New(sess) +type CloudWatchEventsTargetLister struct{} + +func (l *CloudWatchEventsTargetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatchevents.New(opts.Session) resp, err := svc.ListEventBuses(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, bus := range resp.EventBuses { resp, err := svc.ListRules(&cloudwatchevents.ListRulesInput{ EventBusName: bus.Name, @@ -57,7 +72,7 @@ type CloudWatchEventsTarget struct { busName *string } -func (target *CloudWatchEventsTarget) Remove() error { +func (target *CloudWatchEventsTarget) Remove(_ context.Context) error { ids := []*string{target.targetId} _, err := target.svc.RemoveTargets(&cloudwatchevents.RemoveTargetsInput{ Ids: ids, @@ -69,5 +84,7 @@ func (target *CloudWatchEventsTarget) Remove() error { } func (target *CloudWatchEventsTarget) String() string { + // TODO: change this to IAM format rule -> target and mark as breaking change for filters + // TODO: add properties for rule and target separately return fmt.Sprintf("Rule: %s Target ID: %s", *target.ruleName, *target.targetId) } diff --git a/resources/cloudwatchlogs-destinations.go b/resources/cloudwatchlogs-destinations.go index e18f9bef2..97d7050ed 100644 --- a/resources/cloudwatchlogs-destinations.go +++ b/resources/cloudwatchlogs-destinations.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudWatchLogsDestination struct { - svc *cloudwatchlogs.CloudWatchLogs - destinationName *string -} +const CloudWatchLogsDestinationResource = "CloudWatchLogsDestination" func init() { - register("CloudWatchLogsDestination", ListCloudWatchLogsDestinations) + resource.Register(resource.Registration{ + Name: CloudWatchLogsDestinationResource, + Scope: nuke.Account, + Lister: &CloudWatchLogsDestinationLister{}, + }) } -func ListCloudWatchLogsDestinations(sess *session.Session) ([]Resource, error) { - svc := cloudwatchlogs.New(sess) - resources := []Resource{} +type CloudWatchLogsDestinationLister struct{} + +func (l *CloudWatchLogsDestinationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatchlogs.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudwatchlogs.DescribeDestinationsInput{ Limit: aws.Int64(50), @@ -46,8 +56,12 @@ func ListCloudWatchLogsDestinations(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudWatchLogsDestination) Remove() error { +type CloudWatchLogsDestination struct { + svc *cloudwatchlogs.CloudWatchLogs + destinationName *string +} +func (f *CloudWatchLogsDestination) Remove(_ context.Context) error { _, err := f.svc.DeleteDestination(&cloudwatchlogs.DeleteDestinationInput{ DestinationName: f.destinationName, }) diff --git a/resources/cloudwatchlogs-loggroups.go b/resources/cloudwatchlogs-loggroups.go index 76610dd38..4c8850400 100644 --- a/resources/cloudwatchlogs-loggroups.go +++ b/resources/cloudwatchlogs-loggroups.go @@ -1,29 +1,37 @@ package resources import ( + "context" + "strings" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudWatchLogsLogGroup struct { - svc *cloudwatchlogs.CloudWatchLogs - logGroup *cloudwatchlogs.LogGroup - lastEvent string - tags map[string]*string -} +const CloudWatchLogsLogGroupResource = "CloudWatchLogsLogGroup" func init() { - register("CloudWatchLogsLogGroup", ListCloudWatchLogsLogGroups) + resource.Register(resource.Registration{ + Name: CloudWatchLogsLogGroupResource, + Scope: nuke.Account, + Lister: &CloudWatchLogsLogGroupLister{}, + }) } -func ListCloudWatchLogsLogGroups(sess *session.Session) ([]Resource, error) { - svc := cloudwatchlogs.New(sess) - resources := []Resource{} +type CloudWatchLogsLogGroupLister struct{} + +func (l *CloudWatchLogsLogGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatchlogs.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudwatchlogs.DescribeLogGroupsInput{ Limit: aws.Int64(50), @@ -80,8 +88,14 @@ func ListCloudWatchLogsLogGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CloudWatchLogsLogGroup) Remove() error { +type CloudWatchLogsLogGroup struct { + svc *cloudwatchlogs.CloudWatchLogs + logGroup *cloudwatchlogs.LogGroup + lastEvent string + tags map[string]*string +} +func (f *CloudWatchLogsLogGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteLogGroup(&cloudwatchlogs.DeleteLogGroupInput{ LogGroupName: f.logGroup.LogGroupName, }) diff --git a/resources/cloudwatchlogs-resourcepolicy.go b/resources/cloudwatchlogs-resourcepolicy.go index d8f609d04..8eb5566c8 100644 --- a/resources/cloudwatchlogs-resourcepolicy.go +++ b/resources/cloudwatchlogs-resourcepolicy.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CloudWatchLogsResourcePolicy struct { - svc *cloudwatchlogs.CloudWatchLogs - policyName *string -} +const CloudWatchLogsResourcePolicyResource = "CloudWatchLogsResourcePolicy" func init() { - register("CloudWatchLogsResourcePolicy", ListCloudWatchLogsResourcePolicies) + resource.Register(resource.Registration{ + Name: CloudWatchLogsResourcePolicyResource, + Scope: nuke.Account, + Lister: &CloudWatchLogsResourcePolicyLister{}, + }) } -func ListCloudWatchLogsResourcePolicies(sess *session.Session) ([]Resource, error) { - svc := cloudwatchlogs.New(sess) - resources := []Resource{} +type CloudWatchLogsResourcePolicyLister struct{} + +func (l *CloudWatchLogsResourcePolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cloudwatchlogs.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cloudwatchlogs.DescribeResourcePoliciesInput{ Limit: aws.Int64(50), @@ -47,8 +57,12 @@ func ListCloudWatchLogsResourcePolicies(sess *session.Session) ([]Resource, erro return resources, nil } -func (p *CloudWatchLogsResourcePolicy) Remove() error { +type CloudWatchLogsResourcePolicy struct { + svc *cloudwatchlogs.CloudWatchLogs + policyName *string +} +func (p *CloudWatchLogsResourcePolicy) Remove(_ context.Context) error { _, err := p.svc.DeleteResourcePolicy(&cloudwatchlogs.DeleteResourcePolicyInput{ PolicyName: p.policyName, }) diff --git a/resources/codeartifact-domains.go b/resources/codeartifact-domains.go index f419594a6..a64054d4b 100644 --- a/resources/codeartifact-domains.go +++ b/resources/codeartifact-domains.go @@ -1,24 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/codeartifact" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeArtifactDomain struct { - svc *codeartifact.CodeArtifact - name *string - tags map[string]*string -} +const CodeArtifactDomainResource = "CodeArtifactDomain" func init() { - register("CodeArtifactDomain", ListCodeArtifactDomains) + resource.Register(resource.Registration{ + Name: CodeArtifactDomainResource, + Scope: nuke.Account, + Lister: &CodeArtifactDomainLister{}, + }) } -func ListCodeArtifactDomains(sess *session.Session) ([]Resource, error) { - svc := codeartifact.New(sess) - resources := []Resource{} +type CodeArtifactDomainLister struct{} + +func (l *CodeArtifactDomainLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codeartifact.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codeartifact.ListDomainsInput{} @@ -62,7 +71,13 @@ func GetDomainTags(svc *codeartifact.CodeArtifact, arn *string) map[string]*stri return tags } -func (d *CodeArtifactDomain) Remove() error { +type CodeArtifactDomain struct { + svc *codeartifact.CodeArtifact + name *string + tags map[string]*string +} + +func (d *CodeArtifactDomain) Remove(_ context.Context) error { _, err := d.svc.DeleteDomain(&codeartifact.DeleteDomainInput{ Domain: d.name, }) diff --git a/resources/codeartifact-repositories.go b/resources/codeartifact-repositories.go index 90bd51e53..ddea3331a 100644 --- a/resources/codeartifact-repositories.go +++ b/resources/codeartifact-repositories.go @@ -1,25 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/codeartifact" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeArtifactRepository struct { - svc *codeartifact.CodeArtifact - name *string - domain *string - tags map[string]*string -} +const CodeArtifactRepositoryResource = "CodeArtifactRepository" func init() { - register("CodeArtifactRepository", ListCodeArtifactRepositories) + resource.Register(resource.Registration{ + Name: CodeArtifactRepositoryResource, + Scope: nuke.Account, + Lister: &CodeArtifactRepositoryLister{}, + }) } -func ListCodeArtifactRepositories(sess *session.Session) ([]Resource, error) { - svc := codeartifact.New(sess) - resources := []Resource{} +type CodeArtifactRepositoryLister struct{} + +func (l *CodeArtifactRepositoryLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codeartifact.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codeartifact.ListRepositoriesInput{} @@ -61,7 +69,14 @@ func GetRepositoryTags(svc *codeartifact.CodeArtifact, arn *string) map[string]* return tags } -func (r *CodeArtifactRepository) Remove() error { +type CodeArtifactRepository struct { + svc *codeartifact.CodeArtifact + name *string + domain *string + tags map[string]*string +} + +func (r *CodeArtifactRepository) Remove(_ context.Context) error { _, err := r.svc.DeleteRepository(&codeartifact.DeleteRepositoryInput{ Repository: r.name, Domain: r.domain, diff --git a/resources/codebuild-projects.go b/resources/codebuild-projects.go index 97d901c69..19ecd0f73 100644 --- a/resources/codebuild-projects.go +++ b/resources/codebuild-projects.go @@ -1,21 +1,28 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/codebuild" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeBuildProject struct { - svc *codebuild.CodeBuild - projectName *string - tags map[string]*string -} +const CodeBuildProjectResource = "CodeBuildProject" func init() { - register("CodeBuildProject", ListCodeBuildProjects) + resource.Register(resource.Registration{ + Name: CodeBuildProjectResource, + Scope: nuke.Account, + Lister: &CodeBuildProjectLister{}, + }) } +type CodeBuildProjectLister struct{} + func GetTags(svc *codebuild.CodeBuild, project *string) map[string]*string { tags := make(map[string]*string) batchResult, _ := svc.BatchGetProjects(&codebuild.BatchGetProjectsInput{Names: []*string{project}}) @@ -34,9 +41,11 @@ func GetTags(svc *codebuild.CodeBuild, project *string) map[string]*string { return nil } -func ListCodeBuildProjects(sess *session.Session) ([]Resource, error) { - svc := codebuild.New(sess) - resources := []Resource{} +func (l *CodeBuildProjectLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codebuild.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codebuild.ListProjectsInput{} @@ -64,8 +73,13 @@ func ListCodeBuildProjects(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CodeBuildProject) Remove() error { +type CodeBuildProject struct { + svc *codebuild.CodeBuild + projectName *string + tags map[string]*string +} +func (f *CodeBuildProject) Remove(_ context.Context) error { _, err := f.svc.DeleteProject(&codebuild.DeleteProjectInput{ Name: f.projectName, }) diff --git a/resources/codecommit-repositories.go b/resources/codecommit-repositories.go index 7efa01222..2a2c4ec8b 100644 --- a/resources/codecommit-repositories.go +++ b/resources/codecommit-repositories.go @@ -1,22 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/codecommit" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeCommitRepository struct { - svc *codecommit.CodeCommit - repositoryName *string -} +const CodeCommitRepositoryResource = "CodeCommitRepository" func init() { - register("CodeCommitRepository", ListCodeCommitRepositories) + resource.Register(resource.Registration{ + Name: CodeCommitRepositoryResource, + Scope: nuke.Account, + Lister: &CodeCommitRepositoryLister{}, + }) } -func ListCodeCommitRepositories(sess *session.Session) ([]Resource, error) { - svc := codecommit.New(sess) - resources := []Resource{} +type CodeCommitRepositoryLister struct{} + +// List - Return a list of all CodeCommit Repositories as Resources +func (l *CodeCommitRepositoryLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codecommit.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codecommit.ListRepositoriesInput{} @@ -43,8 +54,13 @@ func ListCodeCommitRepositories(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CodeCommitRepository) Remove() error { +type CodeCommitRepository struct { + svc *codecommit.CodeCommit + repositoryName *string +} +// Remove - Removes the CodeCommit Repository +func (f *CodeCommitRepository) Remove(_ context.Context) error { _, err := f.svc.DeleteRepository(&codecommit.DeleteRepositoryInput{ RepositoryName: f.repositoryName, }) diff --git a/resources/codedeploy-applications.go b/resources/codedeploy-applications.go index 9900f7b38..e2145862a 100644 --- a/resources/codedeploy-applications.go +++ b/resources/codedeploy-applications.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/codedeploy" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeDeployApplication struct { - svc *codedeploy.CodeDeploy - applicationName *string -} +const CodeDeployApplicationResource = "CodeDeployApplication" func init() { - register("CodeDeployApplication", ListCodeDeployApplications) + resource.Register(resource.Registration{ + Name: CodeDeployApplicationResource, + Scope: nuke.Account, + Lister: &CodeDeployApplicationLister{}, + }) } -func ListCodeDeployApplications(sess *session.Session) ([]Resource, error) { - svc := codedeploy.New(sess) - resources := []Resource{} +type CodeDeployApplicationLister struct{} + +func (l *CodeDeployApplicationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codedeploy.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codedeploy.ListApplicationsInput{} @@ -43,8 +53,12 @@ func ListCodeDeployApplications(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CodeDeployApplication) Remove() error { +type CodeDeployApplication struct { + svc *codedeploy.CodeDeploy + applicationName *string +} +func (f *CodeDeployApplication) Remove(_ context.Context) error { _, err := f.svc.DeleteApplication(&codedeploy.DeleteApplicationInput{ ApplicationName: f.applicationName, }) diff --git a/resources/codepipeline-pipelines.go b/resources/codepipeline-pipelines.go index ba436a27b..3b43972e6 100644 --- a/resources/codepipeline-pipelines.go +++ b/resources/codepipeline-pipelines.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/codepipeline" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodePipelinePipeline struct { - svc *codepipeline.CodePipeline - pipelineName *string -} +const CodePipelinePipelineResource = "CodePipelinePipeline" func init() { - register("CodePipelinePipeline", ListCodePipelinePipelines) + resource.Register(resource.Registration{ + Name: CodePipelinePipelineResource, + Scope: nuke.Account, + Lister: &CodePipelinePipelineLister{}, + }) } -func ListCodePipelinePipelines(sess *session.Session) ([]Resource, error) { - svc := codepipeline.New(sess) - resources := []Resource{} +type CodePipelinePipelineLister struct{} + +func (l *CodePipelinePipelineLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codepipeline.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codepipeline.ListPipelinesInput{} @@ -43,8 +53,12 @@ func ListCodePipelinePipelines(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CodePipelinePipeline) Remove() error { +type CodePipelinePipeline struct { + svc *codepipeline.CodePipeline + pipelineName *string +} +func (f *CodePipelinePipeline) Remove(_ context.Context) error { _, err := f.svc.DeletePipeline(&codepipeline.DeletePipelineInput{ Name: f.pipelineName, }) diff --git a/resources/codestar-connections.go b/resources/codestar-connections.go index 1d49201cd..21d84251a 100644 --- a/resources/codestar-connections.go +++ b/resources/codestar-connections.go @@ -1,26 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/codestarconnections" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeStarConnection struct { - svc *codestarconnections.CodeStarConnections - connectionARN *string - connectionName *string - providerType *string -} +const CodeStarConnectionResource = "CodeStarConnection" func init() { - register("CodeStarConnection", ListCodeStarConnections) + resource.Register(resource.Registration{ + Name: CodeStarConnectionResource, + Scope: nuke.Account, + Lister: &CodeStarConnectionLister{}, + }) } -func ListCodeStarConnections(sess *session.Session) ([]Resource, error) { - svc := codestarconnections.New(sess) - resources := []Resource{} +type CodeStarConnectionLister struct{} + +func (l *CodeStarConnectionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codestarconnections.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codestarconnections.ListConnectionsInput{ MaxResults: aws.Int64(100), @@ -34,10 +42,10 @@ func ListCodeStarConnections(sess *session.Session) ([]Resource, error) { for _, connection := range output.Connections { resources = append(resources, &CodeStarConnection{ - svc: svc, - connectionARN: connection.ConnectionArn, - connectionName: connection.ConnectionName, - providerType: connection.ProviderType, + svc: svc, + connectionARN: connection.ConnectionArn, + connectionName: connection.ConnectionName, + providerType: connection.ProviderType, }) } @@ -51,8 +59,14 @@ func ListCodeStarConnections(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CodeStarConnection) Remove() error { +type CodeStarConnection struct { + svc *codestarconnections.CodeStarConnections + connectionARN *string + connectionName *string + providerType *string +} +func (f *CodeStarConnection) Remove(_ context.Context) error { _, err := f.svc.DeleteConnection(&codestarconnections.DeleteConnectionInput{ ConnectionArn: f.connectionARN, }) @@ -68,7 +82,6 @@ func (f *CodeStarConnection) Properties() types.Properties { return properties } - func (f *CodeStarConnection) String() string { return *f.connectionName } diff --git a/resources/codestar-notifications.go b/resources/codestar-notifications.go index 1d78b2873..a15be1d12 100644 --- a/resources/codestar-notifications.go +++ b/resources/codestar-notifications.go @@ -1,29 +1,36 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/codestarnotifications" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeStarNotificationRule struct { - svc *codestarnotifications.CodeStarNotifications - id *string - name *string - arn *string - tags map[string]*string -} +const CodeStarNotificationRuleResource = "CodeStarNotificationRule" func init() { - register("CodeStarNotificationRule", ListCodeStarNotificationRules) + resource.Register(resource.Registration{ + Name: CodeStarNotificationRuleResource, + Scope: nuke.Account, + Lister: &CodeStarNotificationRuleLister{}, + }) } -func ListCodeStarNotificationRules(sess *session.Session) ([]Resource, error) { - svc := codestarnotifications.New(sess) - resources := []Resource{} +type CodeStarNotificationRuleLister struct{} + +func (l *CodeStarNotificationRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codestarnotifications.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codestarnotifications.ListNotificationRulesInput{ MaxResults: aws.Int64(100), @@ -62,8 +69,15 @@ func ListCodeStarNotificationRules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (cn *CodeStarNotificationRule) Remove() error { +type CodeStarNotificationRule struct { + svc *codestarnotifications.CodeStarNotifications + id *string + name *string + arn *string + tags map[string]*string +} +func (cn *CodeStarNotificationRule) Remove(_ context.Context) error { _, err := cn.svc.DeleteNotificationRule(&codestarnotifications.DeleteNotificationRuleInput{ Arn: cn.arn, }) diff --git a/resources/codestar-projects.go b/resources/codestar-projects.go index ef80c61d0..e8d54c259 100644 --- a/resources/codestar-projects.go +++ b/resources/codestar-projects.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/codestar" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CodeStarProject struct { - svc *codestar.CodeStar - id *string -} +const CodeStarProjectResource = "CodeStarProject" func init() { - register("CodeStarProject", ListCodeStarProjects) + resource.Register(resource.Registration{ + Name: CodeStarProjectResource, + Scope: nuke.Account, + Lister: &CodeStarProjectLister{}, + }) } -func ListCodeStarProjects(sess *session.Session) ([]Resource, error) { - svc := codestar.New(sess) - resources := []Resource{} +type CodeStarProjectLister struct{} + +func (l *CodeStarProjectLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := codestar.New(opts.Session) + resources := make([]resource.Resource, 0) params := &codestar.ListProjectsInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListCodeStarProjects(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CodeStarProject) Remove() error { +type CodeStarProject struct { + svc *codestar.CodeStar + id *string +} +func (f *CodeStarProject) Remove(_ context.Context) error { _, err := f.svc.DeleteProject(&codestar.DeleteProjectInput{ Id: f.id, }) diff --git a/resources/cognito-identity-providers.go b/resources/cognito-identity-providers.go index 6c80cd701..6ad4be5af 100644 --- a/resources/cognito-identity-providers.go +++ b/resources/cognito-identity-providers.go @@ -1,34 +1,43 @@ package resources import ( + "context" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cognitoidentityprovider" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CognitoIdentityProvider struct { - svc *cognitoidentityprovider.CognitoIdentityProvider - name *string - providerType *string - userPoolName *string - userPoolId *string -} +const CognitoIdentityProviderResource = "CognitoIdentityProvider" func init() { - register("CognitoIdentityProvider", ListCognitoIdentityProviders) + resource.Register(resource.Registration{ + Name: CognitoIdentityProviderResource, + Scope: nuke.Account, + Lister: &CognitoIdentityProviderLister{}, + }) } -func ListCognitoIdentityProviders(sess *session.Session) ([]Resource, error) { - svc := cognitoidentityprovider.New(sess) +type CognitoIdentityProviderLister struct{} + +func (l *CognitoIdentityProviderLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - userPools, poolErr := ListCognitoUserPools(sess) + svc := cognitoidentityprovider.New(opts.Session) + + userPoolsLister := &CognitoUserPoolLister{} + userPools, poolErr := userPoolsLister.List(ctx, o) if poolErr != nil { return nil, poolErr } - resources := []Resource{} + resources := make([]resource.Resource, 0) for _, userPoolResource := range userPools { userPool, ok := userPoolResource.(*CognitoUserPool) @@ -69,8 +78,15 @@ func ListCognitoIdentityProviders(sess *session.Session) ([]Resource, error) { return resources, nil } -func (p *CognitoIdentityProvider) Remove() error { +type CognitoIdentityProvider struct { + svc *cognitoidentityprovider.CognitoIdentityProvider + name *string + providerType *string + userPoolName *string + userPoolId *string +} +func (p *CognitoIdentityProvider) Remove(_ context.Context) error { _, err := p.svc.DeleteIdentityProvider(&cognitoidentityprovider.DeleteIdentityProviderInput{ UserPoolId: p.userPoolId, ProviderName: p.name, diff --git a/resources/cognito-identitypools.go b/resources/cognito-identitypools.go index ee67df420..f591ef735 100644 --- a/resources/cognito-identitypools.go +++ b/resources/cognito-identitypools.go @@ -1,8 +1,13 @@ package resources import ( + "context" + + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/cognitoidentity" ) @@ -12,13 +17,23 @@ type CognitoIdentityPool struct { id *string } +const CognitoIdentityPoolResource = "CognitoIdentityPool" + func init() { - register("CognitoIdentityPool", ListCognitoIdentityPools) + resource.Register(resource.Registration{ + Name: CognitoIdentityPoolResource, + Scope: nuke.Account, + Lister: &CognitoIdentityPoolLister{}, + }) } -func ListCognitoIdentityPools(sess *session.Session) ([]Resource, error) { - svc := cognitoidentity.New(sess) - resources := []Resource{} +type CognitoIdentityPoolLister struct{} + +func (l *CognitoIdentityPoolLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cognitoidentity.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cognitoidentity.ListIdentityPoolsInput{ MaxResults: aws.Int64(50), @@ -48,7 +63,7 @@ func ListCognitoIdentityPools(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CognitoIdentityPool) Remove() error { +func (f *CognitoIdentityPool) Remove(_ context.Context) error { _, err := f.svc.DeleteIdentityPool(&cognitoidentity.DeleteIdentityPoolInput{ IdentityPoolId: f.id, diff --git a/resources/cognito-userpool-clients.go b/resources/cognito-userpool-clients.go index e715dbe16..d8f595107 100644 --- a/resources/cognito-userpool-clients.go +++ b/resources/cognito-userpool-clients.go @@ -1,34 +1,43 @@ package resources import ( + "context" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cognitoidentityprovider" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CognitoUserPoolClient struct { - svc *cognitoidentityprovider.CognitoIdentityProvider - name *string - id *string - userPoolName *string - userPoolId *string -} +const CognitoUserPoolClientResource = "CognitoUserPoolClient" func init() { - register("CognitoUserPoolClient", ListCognitoUserPoolClients) + resource.Register(resource.Registration{ + Name: CognitoUserPoolClientResource, + Scope: nuke.Account, + Lister: &CognitoUserPoolClientLister{}, + }) } -func ListCognitoUserPoolClients(sess *session.Session) ([]Resource, error) { - svc := cognitoidentityprovider.New(sess) +type CognitoUserPoolClientLister struct{} + +func (l *CognitoUserPoolClientLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - userPools, poolErr := ListCognitoUserPools(sess) + svc := cognitoidentityprovider.New(opts.Session) + + userPoolsLister := &CognitoUserPoolLister{} + userPools, poolErr := userPoolsLister.List(ctx, o) if poolErr != nil { return nil, poolErr } - resources := []Resource{} + resources := make([]resource.Resource, 0) for _, userPoolResource := range userPools { userPool, ok := userPoolResource.(*CognitoUserPool) @@ -69,8 +78,15 @@ func ListCognitoUserPoolClients(sess *session.Session) ([]Resource, error) { return resources, nil } -func (p *CognitoUserPoolClient) Remove() error { +type CognitoUserPoolClient struct { + svc *cognitoidentityprovider.CognitoIdentityProvider + name *string + id *string + userPoolName *string + userPoolId *string +} +func (p *CognitoUserPoolClient) Remove(_ context.Context) error { _, err := p.svc.DeleteUserPoolClient(&cognitoidentityprovider.DeleteUserPoolClientInput{ ClientId: p.id, UserPoolId: p.userPoolId, diff --git a/resources/cognito-userpool-domains.go b/resources/cognito-userpool-domains.go index 3e36c1654..30df2ca95 100644 --- a/resources/cognito-userpool-domains.go +++ b/resources/cognito-userpool-domains.go @@ -1,31 +1,41 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/cognitoidentityprovider" + "context" + "github.com/sirupsen/logrus" + + "github.com/aws/aws-sdk-go/service/cognitoidentityprovider" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CognitoUserPoolDomain struct { - svc *cognitoidentityprovider.CognitoIdentityProvider - name *string - userPoolName *string - userPoolId *string -} +const CognitoUserPoolDomainResource = "CognitoUserPoolDomain" func init() { - register("CognitoUserPoolDomain", ListCognitoUserPoolDomains) + resource.Register(resource.Registration{ + Name: CognitoUserPoolDomainResource, + Scope: nuke.Account, + Lister: &CognitoUserPoolDomainLister{}, + }) } -func ListCognitoUserPoolDomains(sess *session.Session) ([]Resource, error) { - svc := cognitoidentityprovider.New(sess) +type CognitoUserPoolDomainLister struct{} + +func (l *CognitoUserPoolDomainLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cognitoidentityprovider.New(opts.Session) - userPools, poolErr := ListCognitoUserPools(sess) + userPoolsLister := &CognitoUserPoolLister{} + userPools, poolErr := userPoolsLister.List(ctx, o) if poolErr != nil { return nil, poolErr } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, userPoolResource := range userPools { userPool, ok := userPoolResource.(*CognitoUserPool) if !ok { @@ -56,7 +66,14 @@ func ListCognitoUserPoolDomains(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CognitoUserPoolDomain) Remove() error { +type CognitoUserPoolDomain struct { + svc *cognitoidentityprovider.CognitoIdentityProvider + name *string + userPoolName *string + userPoolId *string +} + +func (f *CognitoUserPoolDomain) Remove(_ context.Context) error { params := &cognitoidentityprovider.DeleteUserPoolDomainInput{ Domain: f.name, UserPoolId: f.userPoolId, diff --git a/resources/cognito-userpools.go b/resources/cognito-userpools.go index c1a5f8190..b46c57bbe 100644 --- a/resources/cognito-userpools.go +++ b/resources/cognito-userpools.go @@ -1,24 +1,38 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cognitoidentityprovider" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type CognitoUserPool struct { - svc *cognitoidentityprovider.CognitoIdentityProvider - name *string - id *string -} +const CognitoUserPoolResource = "CognitoUserPool" func init() { - register("CognitoUserPool", ListCognitoUserPools) + resource.Register(resource.Registration{ + Name: CognitoUserPoolResource, + Scope: nuke.Account, + Lister: &CognitoUserPoolLister{}, + DependsOn: []string{ + CognitoIdentityPoolResource, + CognitoUserPoolClientResource, + CognitoUserPoolDomainResource, + }, + }) } -func ListCognitoUserPools(sess *session.Session) ([]Resource, error) { - svc := cognitoidentityprovider.New(sess) - resources := []Resource{} +type CognitoUserPoolLister struct{} + +func (l *CognitoUserPoolLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := cognitoidentityprovider.New(opts.Session) + resources := make([]resource.Resource, 0) params := &cognitoidentityprovider.ListUserPoolsInput{ MaxResults: aws.Int64(50), @@ -48,8 +62,13 @@ func ListCognitoUserPools(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *CognitoUserPool) Remove() error { +type CognitoUserPool struct { + svc *cognitoidentityprovider.CognitoIdentityProvider + name *string + id *string +} +func (f *CognitoUserPool) Remove(_ context.Context) error { _, err := f.svc.DeleteUserPool(&cognitoidentityprovider.DeleteUserPoolInput{ UserPoolId: f.id, }) diff --git a/resources/comprehend_document_classifier.go b/resources/comprehend-document-classifier.go similarity index 75% rename from resources/comprehend_document_classifier.go rename to resources/comprehend-document-classifier.go index 680e8bbd8..27478b771 100644 --- a/resources/comprehend_document_classifier.go +++ b/resources/comprehend-document-classifier.go @@ -1,21 +1,37 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/comprehend" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "context" + "github.com/sirupsen/logrus" + + "github.com/aws/aws-sdk-go/service/comprehend" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const ComprehendDocumentClassifierResource = "ComprehendDocumentClassifier" + func init() { - register("ComprehendDocumentClassifier", ListComprehendDocumentClassifiers) + resource.Register(resource.Registration{ + Name: ComprehendDocumentClassifierResource, + Scope: nuke.Account, + Lister: &ComprehendDocumentClassifierLister{}, + }) } -func ListComprehendDocumentClassifiers(sess *session.Session) ([]Resource, error) { - svc := comprehend.New(sess) +type ComprehendDocumentClassifierLister struct{} + +func (l *ComprehendDocumentClassifierLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := comprehend.New(opts.Session) params := &comprehend.ListDocumentClassifiersInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListDocumentClassifiers(params) @@ -44,7 +60,7 @@ type ComprehendDocumentClassifier struct { documentClassifier *comprehend.DocumentClassifierProperties } -func (ce *ComprehendDocumentClassifier) Remove() error { +func (ce *ComprehendDocumentClassifier) Remove(_ context.Context) error { switch *ce.documentClassifier.Status { case "IN_ERROR": fallthrough diff --git a/resources/comprehend_dominant_language_detection_job.go b/resources/comprehend-dominant-language-detection-job.go similarity index 65% rename from resources/comprehend_dominant_language_detection_job.go rename to resources/comprehend-dominant-language-detection-job.go index 26bcf8609..4905da3b1 100644 --- a/resources/comprehend_dominant_language_detection_job.go +++ b/resources/comprehend-dominant-language-detection-job.go @@ -1,20 +1,35 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/comprehend" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const ComprehendDominantLanguageDetectionJobResource = "ComprehendDominantLanguageDetectionJob" + func init() { - register("ComprehendDominantLanguageDetectionJob", ListComprehendDominantLanguageDetectionJobs) + resource.Register(resource.Registration{ + Name: ComprehendDominantLanguageDetectionJobResource, + Scope: nuke.Account, + Lister: &ComprehendDominantLanguageDetectionJobLister{}, + }) } -func ListComprehendDominantLanguageDetectionJobs(sess *session.Session) ([]Resource, error) { - svc := comprehend.New(sess) +type ComprehendDominantLanguageDetectionJobLister struct{} + +func (l *ComprehendDominantLanguageDetectionJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := comprehend.New(opts.Session) params := &comprehend.ListDominantLanguageDetectionJobsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListDominantLanguageDetectionJobs(params) @@ -43,7 +58,7 @@ type ComprehendDominantLanguageDetectionJob struct { dominantLanguageDetectionJob *comprehend.DominantLanguageDetectionJobProperties } -func (ce *ComprehendDominantLanguageDetectionJob) Remove() error { +func (ce *ComprehendDominantLanguageDetectionJob) Remove(_ context.Context) error { _, err := ce.svc.StopDominantLanguageDetectionJob(&comprehend.StopDominantLanguageDetectionJobInput{ JobId: ce.dominantLanguageDetectionJob.JobId, }) diff --git a/resources/comprehend_endpoint.go b/resources/comprehend-endpoint.go similarity index 61% rename from resources/comprehend_endpoint.go rename to resources/comprehend-endpoint.go index 59c81fb8a..384c81bc1 100644 --- a/resources/comprehend_endpoint.go +++ b/resources/comprehend-endpoint.go @@ -1,20 +1,35 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/comprehend" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const ComprehendEndpointResource = "ComprehendEndpoint" + func init() { - register("ComprehendEndpoint", ListComprehendEndpoints) + resource.Register(resource.Registration{ + Name: ComprehendEndpointResource, + Scope: nuke.Account, + Lister: &ComprehendEndpointLister{}, + }) } -func ListComprehendEndpoints(sess *session.Session) ([]Resource, error) { - svc := comprehend.New(sess) +type ComprehendEndpointLister struct{} + +func (l *ComprehendEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := comprehend.New(opts.Session) params := &comprehend.ListEndpointsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListEndpoints(params) @@ -43,7 +58,7 @@ type ComprehendEndpoint struct { endpoint *comprehend.EndpointProperties } -func (ce *ComprehendEndpoint) Remove() error { +func (ce *ComprehendEndpoint) Remove(_ context.Context) error { _, err := ce.svc.DeleteEndpoint(&comprehend.DeleteEndpointInput{ EndpointArn: ce.endpoint.EndpointArn, }) diff --git a/resources/comprehend_entities_detection_job.go b/resources/comprehend-entities-detection-job.go similarity index 67% rename from resources/comprehend_entities_detection_job.go rename to resources/comprehend-entities-detection-job.go index 3ae804849..10c663e42 100644 --- a/resources/comprehend_entities_detection_job.go +++ b/resources/comprehend-entities-detection-job.go @@ -1,20 +1,35 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/comprehend" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const ComprehendEntitiesDetectionJobResource = "ComprehendEntitiesDetectionJob" + func init() { - register("ComprehendEntitiesDetectionJob", ListComprehendEntitiesDetectionJobs) + resource.Register(resource.Registration{ + Name: ComprehendEntitiesDetectionJobResource, + Scope: nuke.Account, + Lister: &ComprehendEntitiesDetectionJobLister{}, + }) } -func ListComprehendEntitiesDetectionJobs(sess *session.Session) ([]Resource, error) { - svc := comprehend.New(sess) +type ComprehendEntitiesDetectionJobLister struct{} + +func (l *ComprehendEntitiesDetectionJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := comprehend.New(opts.Session) params := &comprehend.ListEntitiesDetectionJobsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListEntitiesDetectionJobs(params) @@ -48,7 +63,7 @@ type ComprehendEntitiesDetectionJob struct { entitiesDetectionJob *comprehend.EntitiesDetectionJobProperties } -func (ce *ComprehendEntitiesDetectionJob) Remove() error { +func (ce *ComprehendEntitiesDetectionJob) Remove(_ context.Context) error { _, err := ce.svc.StopEntitiesDetectionJob(&comprehend.StopEntitiesDetectionJobInput{ JobId: ce.entitiesDetectionJob.JobId, }) diff --git a/resources/comprehend_entity_recognizer.go b/resources/comprehend-entity-recognizer.go similarity index 74% rename from resources/comprehend_entity_recognizer.go rename to resources/comprehend-entity-recognizer.go index 61f575935..982701d51 100644 --- a/resources/comprehend_entity_recognizer.go +++ b/resources/comprehend-entity-recognizer.go @@ -1,21 +1,37 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/comprehend" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "context" + "github.com/sirupsen/logrus" + + "github.com/aws/aws-sdk-go/service/comprehend" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const ComprehendEntityRecognizerResource = "ComprehendEntityRecognizer" + func init() { - register("ComprehendEntityRecognizer", ListComprehendEntityRecognizers) + resource.Register(resource.Registration{ + Name: ComprehendEntityRecognizerResource, + Scope: nuke.Account, + Lister: &ComprehendEntityRecognizerLister{}, + }) } -func ListComprehendEntityRecognizers(sess *session.Session) ([]Resource, error) { - svc := comprehend.New(sess) +type ComprehendEntityRecognizerLister struct{} + +func (l *ComprehendEntityRecognizerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := comprehend.New(opts.Session) params := &comprehend.ListEntityRecognizersInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListEntityRecognizers(params) @@ -44,7 +60,7 @@ type ComprehendEntityRecognizer struct { entityRecognizer *comprehend.EntityRecognizerProperties } -func (ce *ComprehendEntityRecognizer) Remove() error { +func (ce *ComprehendEntityRecognizer) Remove(_ context.Context) error { switch *ce.entityRecognizer.Status { case "IN_ERROR": fallthrough diff --git a/resources/comprehend_key_phrases_detection_job.go b/resources/comprehend-key-phrases-detection-job.go similarity index 64% rename from resources/comprehend_key_phrases_detection_job.go rename to resources/comprehend-key-phrases-detection-job.go index 3a78d9633..a729b6685 100644 --- a/resources/comprehend_key_phrases_detection_job.go +++ b/resources/comprehend-key-phrases-detection-job.go @@ -1,20 +1,35 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/comprehend" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const ComprehendKeyPhrasesDetectionJobResource = "ComprehendKeyPhrasesDetectionJob" + func init() { - register("ComprehendKeyPhrasesDetectionJob", ListComprehendKeyPhrasesDetectionJobs) + resource.Register(resource.Registration{ + Name: ComprehendKeyPhrasesDetectionJobResource, + Scope: nuke.Account, + Lister: &ComprehendKeyPhrasesDetectionJobLister{}, + }) } -func ListComprehendKeyPhrasesDetectionJobs(sess *session.Session) ([]Resource, error) { - svc := comprehend.New(sess) +type ComprehendKeyPhrasesDetectionJobLister struct{} + +func (l *ComprehendKeyPhrasesDetectionJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := comprehend.New(opts.Session) params := &comprehend.ListKeyPhrasesDetectionJobsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListKeyPhrasesDetectionJobs(params) @@ -43,7 +58,7 @@ type ComprehendKeyPhrasesDetectionJob struct { keyPhrasesDetectionJob *comprehend.KeyPhrasesDetectionJobProperties } -func (ce *ComprehendKeyPhrasesDetectionJob) Remove() error { +func (ce *ComprehendKeyPhrasesDetectionJob) Remove(_ context.Context) error { _, err := ce.svc.StopKeyPhrasesDetectionJob(&comprehend.StopKeyPhrasesDetectionJobInput{ JobId: ce.keyPhrasesDetectionJob.JobId, }) diff --git a/resources/comprehend_sentiment_detection_job.go b/resources/comprehend-sentiment-detection-job.go similarity index 67% rename from resources/comprehend_sentiment_detection_job.go rename to resources/comprehend-sentiment-detection-job.go index eddd20419..84244d6cf 100644 --- a/resources/comprehend_sentiment_detection_job.go +++ b/resources/comprehend-sentiment-detection-job.go @@ -1,20 +1,35 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/comprehend" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const ComprehendSentimentDetectionJobResource = "ComprehendSentimentDetectionJob" + func init() { - register("ComprehendSentimentDetectionJob", ListComprehendSentimentDetectionJobs) + resource.Register(resource.Registration{ + Name: ComprehendSentimentDetectionJobResource, + Scope: nuke.Account, + Lister: &ComprehendSentimentDetectionJobLister{}, + }) } -func ListComprehendSentimentDetectionJobs(sess *session.Session) ([]Resource, error) { - svc := comprehend.New(sess) +type ComprehendSentimentDetectionJobLister struct{} + +func (l *ComprehendSentimentDetectionJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := comprehend.New(opts.Session) params := &comprehend.ListSentimentDetectionJobsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListSentimentDetectionJobs(params) @@ -48,7 +63,7 @@ type ComprehendSentimentDetectionJob struct { sentimentDetectionJob *comprehend.SentimentDetectionJobProperties } -func (ce *ComprehendSentimentDetectionJob) Remove() error { +func (ce *ComprehendSentimentDetectionJob) Remove(_ context.Context) error { _, err := ce.svc.StopSentimentDetectionJob(&comprehend.StopSentimentDetectionJobInput{ JobId: ce.sentimentDetectionJob.JobId, }) diff --git a/resources/configservice-configrules.go b/resources/configservice-configrules.go index 6d6189423..03fcbd719 100644 --- a/resources/configservice-configrules.go +++ b/resources/configservice-configrules.go @@ -1,25 +1,35 @@ package resources import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/configservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ConfigServiceConfigRule struct { - svc *configservice.ConfigService - configRuleName *string - createdBy *string -} +const ConfigServiceConfigRuleResource = "ConfigServiceConfigRule" func init() { - register("ConfigServiceConfigRule", ListConfigServiceConfigRules) + resource.Register(resource.Registration{ + Name: ConfigServiceConfigRuleResource, + Scope: nuke.Account, + Lister: &ConfigServiceConfigRuleLister{}, + }) } -func ListConfigServiceConfigRules(sess *session.Session) ([]Resource, error) { - svc := configservice.New(sess) - var resources []Resource +type ConfigServiceConfigRuleLister struct{} + +func (l *ConfigServiceConfigRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := configservice.New(opts.Session) + var resources []resource.Resource params := &configservice.DescribeConfigRulesInput{} @@ -47,6 +57,12 @@ func ListConfigServiceConfigRules(sess *session.Session) ([]Resource, error) { return resources, nil } +type ConfigServiceConfigRule struct { + svc *configservice.ConfigService + configRuleName *string + createdBy *string +} + func (f *ConfigServiceConfigRule) Filter() error { if aws.StringValue(f.createdBy) == "securityhub.amazonaws.com" { return fmt.Errorf("cannot remove rule owned by securityhub.amazonaws.com") @@ -55,8 +71,7 @@ func (f *ConfigServiceConfigRule) Filter() error { return nil } -func (f *ConfigServiceConfigRule) Remove() error { - +func (f *ConfigServiceConfigRule) Remove(_ context.Context) error { _, err := f.svc.DeleteConfigRule(&configservice.DeleteConfigRuleInput{ ConfigRuleName: f.configRuleName, }) diff --git a/resources/configservice-configurationrecorders.go b/resources/configservice-configurationrecorders.go index 669bbfe31..21ad72961 100644 --- a/resources/configservice-configurationrecorders.go +++ b/resources/configservice-configurationrecorders.go @@ -1,21 +1,31 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/configservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ConfigServiceConfigurationRecorder struct { - svc *configservice.ConfigService - configurationRecorderName *string -} +const ConfigServiceConfigurationRecorderResource = "ConfigServiceConfigurationRecorder" func init() { - register("ConfigServiceConfigurationRecorder", ListConfigServiceConfigurationRecorders) + resource.Register(resource.Registration{ + Name: ConfigServiceConfigurationRecorderResource, + Scope: nuke.Account, + Lister: &ConfigServiceConfigurationRecorderLister{}, + }) } -func ListConfigServiceConfigurationRecorders(sess *session.Session) ([]Resource, error) { - svc := configservice.New(sess) +type ConfigServiceConfigurationRecorderLister struct{} + +func (l *ConfigServiceConfigurationRecorderLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := configservice.New(opts.Session) params := &configservice.DescribeConfigurationRecordersInput{} resp, err := svc.DescribeConfigurationRecorders(params) @@ -23,10 +33,10 @@ func ListConfigServiceConfigurationRecorders(sess *session.Session) ([]Resource, return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, configurationRecorder := range resp.ConfigurationRecorders { resources = append(resources, &ConfigServiceConfigurationRecorder{ - svc: svc, + svc: svc, configurationRecorderName: configurationRecorder.Name, }) } @@ -34,8 +44,12 @@ func ListConfigServiceConfigurationRecorders(sess *session.Session) ([]Resource, return resources, nil } -func (f *ConfigServiceConfigurationRecorder) Remove() error { +type ConfigServiceConfigurationRecorder struct { + svc *configservice.ConfigService + configurationRecorderName *string +} +func (f *ConfigServiceConfigurationRecorder) Remove(_ context.Context) error { _, err := f.svc.DeleteConfigurationRecorder(&configservice.DeleteConfigurationRecorderInput{ ConfigurationRecorderName: f.configurationRecorderName, }) diff --git a/resources/configservice-deliverychannels.go b/resources/configservice-deliverychannels.go index 1d29c92e8..6784cd068 100644 --- a/resources/configservice-deliverychannels.go +++ b/resources/configservice-deliverychannels.go @@ -1,21 +1,31 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/configservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ConfigServiceDeliveryChannel struct { - svc *configservice.ConfigService - deliveryChannelName *string -} +const ConfigServiceDeliveryChannelResource = "ConfigServiceDeliveryChannel" func init() { - register("ConfigServiceDeliveryChannel", ListConfigServiceDeliveryChannels) + resource.Register(resource.Registration{ + Name: ConfigServiceDeliveryChannelResource, + Scope: nuke.Account, + Lister: &ConfigServiceDeliveryChannelLister{}, + }) } -func ListConfigServiceDeliveryChannels(sess *session.Session) ([]Resource, error) { - svc := configservice.New(sess) +type ConfigServiceDeliveryChannelLister struct{} + +func (l *ConfigServiceDeliveryChannelLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := configservice.New(opts.Session) params := &configservice.DescribeDeliveryChannelsInput{} resp, err := svc.DescribeDeliveryChannels(params) @@ -23,7 +33,7 @@ func ListConfigServiceDeliveryChannels(sess *session.Session) ([]Resource, error return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, deliveryChannel := range resp.DeliveryChannels { resources = append(resources, &ConfigServiceDeliveryChannel{ svc: svc, @@ -34,8 +44,12 @@ func ListConfigServiceDeliveryChannels(sess *session.Session) ([]Resource, error return resources, nil } -func (f *ConfigServiceDeliveryChannel) Remove() error { +type ConfigServiceDeliveryChannel struct { + svc *configservice.ConfigService + deliveryChannelName *string +} +func (f *ConfigServiceDeliveryChannel) Remove(_ context.Context) error { _, err := f.svc.DeleteDeliveryChannel(&configservice.DeleteDeliveryChannelInput{ DeliveryChannelName: f.deliveryChannelName, }) diff --git a/resources/databasemigrationservice-certificates.go b/resources/databasemigrationservice-certificates.go index 6d455d5c5..2fc8a326a 100644 --- a/resources/databasemigrationservice-certificates.go +++ b/resources/databasemigrationservice-certificates.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/databasemigrationservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DatabaseMigrationServiceCertificate struct { - svc *databasemigrationservice.DatabaseMigrationService - ARN *string -} +const DatabaseMigrationServiceCertificateResource = "DatabaseMigrationServiceCertificate" func init() { - register("DatabaseMigrationServiceCertificate", ListDatabaseMigrationServiceCertificates) + resource.Register(resource.Registration{ + Name: DatabaseMigrationServiceCertificateResource, + Scope: nuke.Account, + Lister: &DatabaseMigrationServiceCertificateLister{}, + }) } -func ListDatabaseMigrationServiceCertificates(sess *session.Session) ([]Resource, error) { - svc := databasemigrationservice.New(sess) - resources := []Resource{} +type DatabaseMigrationServiceCertificateLister struct{} + +func (l *DatabaseMigrationServiceCertificateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := databasemigrationservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &databasemigrationservice.DescribeCertificatesInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListDatabaseMigrationServiceCertificates(sess *session.Session) ([]Resource return resources, nil } -func (f *DatabaseMigrationServiceCertificate) Remove() error { +type DatabaseMigrationServiceCertificate struct { + svc *databasemigrationservice.DatabaseMigrationService + ARN *string +} +func (f *DatabaseMigrationServiceCertificate) Remove(_ context.Context) error { _, err := f.svc.DeleteEndpoint(&databasemigrationservice.DeleteEndpointInput{ EndpointArn: f.ARN, }) diff --git a/resources/databasemigrationservice-endpoints.go b/resources/databasemigrationservice-endpoints.go index 1bfe86a3e..1cffce3e8 100644 --- a/resources/databasemigrationservice-endpoints.go +++ b/resources/databasemigrationservice-endpoints.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/databasemigrationservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DatabaseMigrationServiceEndpoint struct { - svc *databasemigrationservice.DatabaseMigrationService - ARN *string -} +const DatabaseMigrationServiceEndpointResource = "DatabaseMigrationServiceEndpoint" func init() { - register("DatabaseMigrationServiceEndpoint", ListDatabaseMigrationServiceEndpoints) + resource.Register(resource.Registration{ + Name: DatabaseMigrationServiceEndpointResource, + Scope: nuke.Account, + Lister: &DatabaseMigrationServiceEndpointLister{}, + }) } -func ListDatabaseMigrationServiceEndpoints(sess *session.Session) ([]Resource, error) { - svc := databasemigrationservice.New(sess) - resources := []Resource{} +type DatabaseMigrationServiceEndpointLister struct{} + +func (l *DatabaseMigrationServiceEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := databasemigrationservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &databasemigrationservice.DescribeEndpointsInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListDatabaseMigrationServiceEndpoints(sess *session.Session) ([]Resource, e return resources, nil } -func (f *DatabaseMigrationServiceEndpoint) Remove() error { +type DatabaseMigrationServiceEndpoint struct { + svc *databasemigrationservice.DatabaseMigrationService + ARN *string +} +func (f *DatabaseMigrationServiceEndpoint) Remove(_ context.Context) error { _, err := f.svc.DeleteEndpoint(&databasemigrationservice.DeleteEndpointInput{ EndpointArn: f.ARN, }) diff --git a/resources/databasemigrationservice-eventsubscriptions.go b/resources/databasemigrationservice-eventsubscriptions.go index 1c9fba2a6..7373b33af 100644 --- a/resources/databasemigrationservice-eventsubscriptions.go +++ b/resources/databasemigrationservice-eventsubscriptions.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/databasemigrationservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DatabaseMigrationServiceEventSubscription struct { - svc *databasemigrationservice.DatabaseMigrationService - subscriptionName *string -} +const DatabaseMigrationServiceEventSubscriptionResource = "DatabaseMigrationServiceEventSubscription" func init() { - register("DatabaseMigrationServiceEventSubscription", ListDatabaseMigrationServiceEventSubscriptions) + resource.Register(resource.Registration{ + Name: DatabaseMigrationServiceEventSubscriptionResource, + Scope: nuke.Account, + Lister: &DatabaseMigrationServiceEventSubscriptionLister{}, + }) } -func ListDatabaseMigrationServiceEventSubscriptions(sess *session.Session) ([]Resource, error) { - svc := databasemigrationservice.New(sess) - resources := []Resource{} +type DatabaseMigrationServiceEventSubscriptionLister struct{} + +func (l *DatabaseMigrationServiceEventSubscriptionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := databasemigrationservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &databasemigrationservice.DescribeEventSubscriptionsInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListDatabaseMigrationServiceEventSubscriptions(sess *session.Session) ([]Re return resources, nil } -func (f *DatabaseMigrationServiceEventSubscription) Remove() error { +type DatabaseMigrationServiceEventSubscription struct { + svc *databasemigrationservice.DatabaseMigrationService + subscriptionName *string +} +func (f *DatabaseMigrationServiceEventSubscription) Remove(_ context.Context) error { _, err := f.svc.DeleteEventSubscription(&databasemigrationservice.DeleteEventSubscriptionInput{ SubscriptionName: f.subscriptionName, }) diff --git a/resources/databasemigrationservice-replicationinstances.go b/resources/databasemigrationservice-replicationinstances.go index 69514f402..bcb10882e 100644 --- a/resources/databasemigrationservice-replicationinstances.go +++ b/resources/databasemigrationservice-replicationinstances.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/databasemigrationservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DatabaseMigrationServiceReplicationInstance struct { - svc *databasemigrationservice.DatabaseMigrationService - ARN *string -} +const DatabaseMigrationServiceReplicationInstanceResource = "DatabaseMigrationServiceReplicationInstance" func init() { - register("DatabaseMigrationServiceReplicationInstance", ListDatabaseMigrationServiceReplicationInstances) + resource.Register(resource.Registration{ + Name: DatabaseMigrationServiceReplicationInstanceResource, + Scope: nuke.Account, + Lister: &DatabaseMigrationServiceReplicationInstanceLister{}, + }) } -func ListDatabaseMigrationServiceReplicationInstances(sess *session.Session) ([]Resource, error) { - svc := databasemigrationservice.New(sess) - resources := []Resource{} +type DatabaseMigrationServiceReplicationInstanceLister struct{} + +func (l *DatabaseMigrationServiceReplicationInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := databasemigrationservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &databasemigrationservice.DescribeReplicationInstancesInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListDatabaseMigrationServiceReplicationInstances(sess *session.Session) ([] return resources, nil } -func (f *DatabaseMigrationServiceReplicationInstance) Remove() error { +type DatabaseMigrationServiceReplicationInstance struct { + svc *databasemigrationservice.DatabaseMigrationService + ARN *string +} +func (f *DatabaseMigrationServiceReplicationInstance) Remove(_ context.Context) error { _, err := f.svc.DeleteReplicationInstance(&databasemigrationservice.DeleteReplicationInstanceInput{ ReplicationInstanceArn: f.ARN, }) diff --git a/resources/databasemigrationservice-replicationtasks.go b/resources/databasemigrationservice-replicationtasks.go index 74f4b8157..1f7ec36b7 100644 --- a/resources/databasemigrationservice-replicationtasks.go +++ b/resources/databasemigrationservice-replicationtasks.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/databasemigrationservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DatabaseMigrationServiceReplicationTask struct { - svc *databasemigrationservice.DatabaseMigrationService - ARN *string -} +const DatabaseMigrationServiceReplicationTaskResource = "DatabaseMigrationServiceReplicationTask" func init() { - register("DatabaseMigrationServiceReplicationTask", ListDatabaseMigrationServiceReplicationTasks) + resource.Register(resource.Registration{ + Name: DatabaseMigrationServiceReplicationTaskResource, + Scope: nuke.Account, + Lister: &DatabaseMigrationServiceReplicationTaskLister{}, + }) } -func ListDatabaseMigrationServiceReplicationTasks(sess *session.Session) ([]Resource, error) { - svc := databasemigrationservice.New(sess) - resources := []Resource{} +type DatabaseMigrationServiceReplicationTaskLister struct{} + +func (l *DatabaseMigrationServiceReplicationTaskLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := databasemigrationservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &databasemigrationservice.DescribeReplicationTasksInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListDatabaseMigrationServiceReplicationTasks(sess *session.Session) ([]Reso return resources, nil } -func (f *DatabaseMigrationServiceReplicationTask) Remove() error { +type DatabaseMigrationServiceReplicationTask struct { + svc *databasemigrationservice.DatabaseMigrationService + ARN *string +} +func (f *DatabaseMigrationServiceReplicationTask) Remove(_ context.Context) error { _, err := f.svc.DeleteReplicationTask(&databasemigrationservice.DeleteReplicationTaskInput{ ReplicationTaskArn: f.ARN, }) diff --git a/resources/databasemigrationservice-subnetgroups.go b/resources/databasemigrationservice-subnetgroups.go index 7490dccea..c8be9d480 100644 --- a/resources/databasemigrationservice-subnetgroups.go +++ b/resources/databasemigrationservice-subnetgroups.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/databasemigrationservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DatabaseMigrationServiceSubnetGroup struct { - svc *databasemigrationservice.DatabaseMigrationService - ID *string -} +const DatabaseMigrationServiceSubnetGroupResource = "DatabaseMigrationServiceSubnetGroup" func init() { - register("DatabaseMigrationServiceSubnetGroup", ListDatabaseMigrationServiceSubnetGroups) + resource.Register(resource.Registration{ + Name: DatabaseMigrationServiceSubnetGroupResource, + Scope: nuke.Account, + Lister: &DatabaseMigrationServiceSubnetGroupLister{}, + }) } -func ListDatabaseMigrationServiceSubnetGroups(sess *session.Session) ([]Resource, error) { - svc := databasemigrationservice.New(sess) - resources := []Resource{} +type DatabaseMigrationServiceSubnetGroupLister struct{} + +func (l *DatabaseMigrationServiceSubnetGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := databasemigrationservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &databasemigrationservice.DescribeReplicationSubnetGroupsInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListDatabaseMigrationServiceSubnetGroups(sess *session.Session) ([]Resource return resources, nil } -func (f *DatabaseMigrationServiceSubnetGroup) Remove() error { +type DatabaseMigrationServiceSubnetGroup struct { + svc *databasemigrationservice.DatabaseMigrationService + ID *string +} +func (f *DatabaseMigrationServiceSubnetGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteReplicationSubnetGroup(&databasemigrationservice.DeleteReplicationSubnetGroupInput{ ReplicationSubnetGroupIdentifier: f.ID, }) diff --git a/resources/datapipeline-pipelines.go b/resources/datapipeline-pipelines.go index ef7d3b0ed..ad56b0b12 100644 --- a/resources/datapipeline-pipelines.go +++ b/resources/datapipeline-pipelines.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/datapipeline" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DataPipelinePipeline struct { - svc *datapipeline.DataPipeline - pipelineID *string -} +const DataPipelinePipelineResource = "DataPipelinePipeline" func init() { - register("DataPipelinePipeline", ListDataPipelinePipelines) + resource.Register(resource.Registration{ + Name: DataPipelinePipelineResource, + Scope: nuke.Account, + Lister: &DataPipelinePipelineLister{}, + }) } -func ListDataPipelinePipelines(sess *session.Session) ([]Resource, error) { - svc := datapipeline.New(sess) - resources := []Resource{} +type DataPipelinePipelineLister struct{} + +func (l *DataPipelinePipelineLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := datapipeline.New(opts.Session) + resources := make([]resource.Resource, 0) params := &datapipeline.ListPipelinesInput{} @@ -43,8 +53,12 @@ func ListDataPipelinePipelines(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *DataPipelinePipeline) Remove() error { +type DataPipelinePipeline struct { + svc *datapipeline.DataPipeline + pipelineID *string +} +func (f *DataPipelinePipeline) Remove(_ context.Context) error { _, err := f.svc.DeletePipeline(&datapipeline.DeletePipelineInput{ PipelineId: f.pipelineID, }) diff --git a/resources/dax-clusters.go b/resources/dax-clusters.go index ce96e2b9a..2b937b9b7 100644 --- a/resources/dax-clusters.go +++ b/resources/dax-clusters.go @@ -1,23 +1,37 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dax" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DAXCluster struct { - svc *dax.DAX - clusterName *string -} +const DAXClusterResource = "DAXCluster" func init() { - register("DAXCluster", ListDAXClusters) + resource.Register(resource.Registration{ + Name: DAXClusterResource, + Scope: nuke.Account, + Lister: &DAXClusterLister{}, + DependsOn: []string{ + DAXParameterGroupResource, + DAXSubnetGroupResource, + }, + }) } -func ListDAXClusters(sess *session.Session) ([]Resource, error) { - svc := dax.New(sess) - resources := []Resource{} +type DAXClusterLister struct{} + +func (l *DAXClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := dax.New(opts.Session) + resources := make([]resource.Resource, 0) params := &dax.DescribeClustersInput{ MaxResults: aws.Int64(100), @@ -46,8 +60,12 @@ func ListDAXClusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *DAXCluster) Remove() error { +type DAXCluster struct { + svc *dax.DAX + clusterName *string +} +func (f *DAXCluster) Remove(_ context.Context) error { _, err := f.svc.DeleteCluster(&dax.DeleteClusterInput{ ClusterName: f.clusterName, }) diff --git a/resources/dax-parametergroups.go b/resources/dax-parametergroups.go index 4f133a989..f022040d6 100644 --- a/resources/dax-parametergroups.go +++ b/resources/dax-parametergroups.go @@ -1,11 +1,16 @@ package resources import ( + "context" + "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dax" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type DAXParameterGroup struct { @@ -13,13 +18,23 @@ type DAXParameterGroup struct { parameterGroupName *string } +const DAXParameterGroupResource = "DAXParameterGroup" + func init() { - register("DAXParameterGroup", ListDAXParameterGroups) + resource.Register(resource.Registration{ + Name: DAXParameterGroupResource, + Scope: nuke.Account, + Lister: &DAXParameterGroupLister{}, + }) } -func ListDAXParameterGroups(sess *session.Session) ([]Resource, error) { - svc := dax.New(sess) - resources := []Resource{} +type DAXParameterGroupLister struct{} + +func (l *DAXParameterGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := dax.New(opts.Session) + resources := make([]resource.Resource, 0) params := &dax.DescribeParameterGroupsInput{ MaxResults: aws.Int64(100), @@ -51,8 +66,7 @@ func ListDAXParameterGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *DAXParameterGroup) Remove() error { - +func (f *DAXParameterGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteParameterGroup(&dax.DeleteParameterGroupInput{ ParameterGroupName: f.parameterGroupName, }) diff --git a/resources/dax-subnetgroups.go b/resources/dax-subnetgroups.go index c451f6e8e..0655aba05 100644 --- a/resources/dax-subnetgroups.go +++ b/resources/dax-subnetgroups.go @@ -1,24 +1,35 @@ package resources import ( + "context" + + "fmt" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dax" - "fmt" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DAXSubnetGroup struct { - svc *dax.DAX - subnetGroupName *string -} +const DAXSubnetGroupResource = "DAXSubnetGroup" func init() { - register("DAXSubnetGroup", ListDAXSubnetGroups) + resource.Register(resource.Registration{ + Name: DAXSubnetGroupResource, + Scope: nuke.Account, + Lister: &DAXSubnetGroupLister{}, + }) } -func ListDAXSubnetGroups(sess *session.Session) ([]Resource, error) { - svc := dax.New(sess) - resources := []Resource{} +type DAXSubnetGroupLister struct{} + +func (l *DAXSubnetGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := dax.New(opts.Session) + resources := make([]resource.Resource, 0) params := &dax.DescribeSubnetGroupsInput{ MaxResults: aws.Int64(100), @@ -47,15 +58,19 @@ func ListDAXSubnetGroups(sess *session.Session) ([]Resource, error) { return resources, nil } +type DAXSubnetGroup struct { + svc *dax.DAX + subnetGroupName *string +} + func (f *DAXSubnetGroup) Filter() error { if *f.subnetGroupName == "default" { - return fmt.Errorf("Cannot delete default DAX Subnet group") + return fmt.Errorf("cannot delete default DAX Subnet group") } return nil } -func (f *DAXSubnetGroup) Remove() error { - +func (f *DAXSubnetGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteSubnetGroup(&dax.DeleteSubnetGroupInput{ SubnetGroupName: f.subnetGroupName, }) diff --git a/resources/devicefarm-projects.go b/resources/devicefarm-projects.go index b741fd7af..05b3222c3 100644 --- a/resources/devicefarm-projects.go +++ b/resources/devicefarm-projects.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/devicefarm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DeviceFarmProject struct { - svc *devicefarm.DeviceFarm - ARN *string -} +const DeviceFarmProjectResource = "DeviceFarmProject" func init() { - register("DeviceFarmProject", ListDeviceFarmProjects) + resource.Register(resource.Registration{ + Name: DeviceFarmProjectResource, + Scope: nuke.Account, + Lister: &DeviceFarmProjectLister{}, + }) } -func ListDeviceFarmProjects(sess *session.Session) ([]Resource, error) { - svc := devicefarm.New(sess) - resources := []Resource{} +type DeviceFarmProjectLister struct{} + +func (l *DeviceFarmProjectLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := devicefarm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &devicefarm.ListProjectsInput{} @@ -43,8 +53,12 @@ func ListDeviceFarmProjects(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *DeviceFarmProject) Remove() error { +type DeviceFarmProject struct { + svc *devicefarm.DeviceFarm + ARN *string +} +func (f *DeviceFarmProject) Remove(_ context.Context) error { _, err := f.svc.DeleteProject(&devicefarm.DeleteProjectInput{ Arn: f.ARN, }) diff --git a/resources/directoryservice-directories.go b/resources/directoryservice-directories.go index c2d2207d4..0a7f1528d 100644 --- a/resources/directoryservice-directories.go +++ b/resources/directoryservice-directories.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/directoryservice" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DirectoryServiceDirectory struct { - svc *directoryservice.DirectoryService - directoryID *string -} +const DirectoryServiceDirectoryResource = "DirectoryServiceDirectory" func init() { - register("DirectoryServiceDirectory", ListDirectoryServiceDirectories) + resource.Register(resource.Registration{ + Name: DirectoryServiceDirectoryResource, + Scope: nuke.Account, + Lister: &DirectoryServiceDirectoryLister{}, + }) } -func ListDirectoryServiceDirectories(sess *session.Session) ([]Resource, error) { - svc := directoryservice.New(sess) - resources := []Resource{} +type DirectoryServiceDirectoryLister struct{} + +func (l *DirectoryServiceDirectoryLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := directoryservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &directoryservice.DescribeDirectoriesInput{ Limit: aws.Int64(100), @@ -46,8 +56,12 @@ func ListDirectoryServiceDirectories(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *DirectoryServiceDirectory) Remove() error { +type DirectoryServiceDirectory struct { + svc *directoryservice.DirectoryService + directoryID *string +} +func (f *DirectoryServiceDirectory) Remove(_ context.Context) error { _, err := f.svc.DeleteDirectory(&directoryservice.DeleteDirectoryInput{ DirectoryId: f.directoryID, }) diff --git a/resources/dynamodb-items.go b/resources/dynamodb-items.go index 169c96191..ec32caa68 100644 --- a/resources/dynamodb-items.go +++ b/resources/dynamodb-items.go @@ -1,36 +1,45 @@ package resources import ( + "context" + "strings" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DynamoDBTableItem struct { - svc *dynamodb.DynamoDB - id map[string]*dynamodb.AttributeValue - table *DynamoDBTable - keyName string - keyValue string -} +const DynamoDBTableItemResource = "DynamoDBTableItem" func init() { - register("DynamoDBTableItem", ListDynamoDBItems) + resource.Register(resource.Registration{ + Name: DynamoDBTableItemResource, + Scope: nuke.Account, + Lister: &DynamoDBTableItemLister{}, + }) } -func ListDynamoDBItems(sess *session.Session) ([]Resource, error) { - svc := dynamodb.New(sess) +type DynamoDBTableItemLister struct{} + +func (l *DynamoDBTableItemLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := dynamodb.New(opts.Session) - tables, tablesErr := ListDynamoDBTables(sess) + tableLister := &DynamoDBTableLister{} + tables, tablesErr := tableLister.List(ctx, o) if tablesErr != nil { return nil, tablesErr } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, dynamoTableResource := range tables { dynamoTable, ok := dynamoTableResource.(*DynamoDBTable) if !ok { @@ -83,7 +92,15 @@ func ListDynamoDBItems(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *DynamoDBTableItem) Remove() error { +type DynamoDBTableItem struct { + svc *dynamodb.DynamoDB + id map[string]*dynamodb.AttributeValue + table *DynamoDBTable + keyName string + keyValue string +} + +func (i *DynamoDBTableItem) Remove(_ context.Context) error { params := &dynamodb.DeleteItemInput{ Key: i.id, TableName: &i.table.id, diff --git a/resources/dynamodb-tables.go b/resources/dynamodb-tables.go index 04a57fa17..3df944cac 100644 --- a/resources/dynamodb-tables.go +++ b/resources/dynamodb-tables.go @@ -1,31 +1,43 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type DynamoDBTable struct { - svc *dynamodb.DynamoDB - id string - tags []*dynamodb.Tag -} +const DynamoDBTableResource = "DynamoDBTable" func init() { - register("DynamoDBTable", ListDynamoDBTables) + resource.Register(resource.Registration{ + Name: DynamoDBTableResource, + Scope: nuke.Account, + Lister: &DynamoDBTableLister{}, + DependsOn: []string{ + DynamoDBTableItemResource, + }, + }) } -func ListDynamoDBTables(sess *session.Session) ([]Resource, error) { - svc := dynamodb.New(sess) +type DynamoDBTableLister struct{} + +func (l *DynamoDBTableLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := dynamodb.New(opts.Session) resp, err := svc.ListTables(&dynamodb.ListTablesInput{}) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, tableName := range resp.TableNames { tags, err := GetTableTags(svc, tableName) @@ -34,8 +46,8 @@ func ListDynamoDBTables(sess *session.Session) ([]Resource, error) { } resources = append(resources, &DynamoDBTable{ - svc: svc, - id: *tableName, + svc: svc, + id: *tableName, tags: tags, }) } @@ -43,7 +55,13 @@ func ListDynamoDBTables(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *DynamoDBTable) Remove() error { +type DynamoDBTable struct { + svc *dynamodb.DynamoDB + id string + tags []*dynamodb.Tag +} + +func (i *DynamoDBTable) Remove(_ context.Context) error { params := &dynamodb.DeleteTableInput{ TableName: aws.String(i.id), } @@ -65,7 +83,7 @@ func GetTableTags(svc *dynamodb.DynamoDB, tableName *string) ([]*dynamodb.Tag, e return make([]*dynamodb.Tag, 0), err } - tags, err := svc.ListTagsOfResource(&dynamodb.ListTagsOfResourceInput{ + tags, err := svc.ListTagsOfResource(&dynamodb.ListTagsOfResourceInput{ ResourceArn: result.Table.TableArn, }) @@ -77,17 +95,16 @@ func GetTableTags(svc *dynamodb.DynamoDB, tableName *string) ([]*dynamodb.Tag, e } func (i *DynamoDBTable) Properties() types.Properties { - properties := types.NewProperties() - properties.Set("Identifier", i.id) + properties := types.NewProperties() + properties.Set("Identifier", i.id) - for _, tag := range i.tags { - properties.SetTag(tag.Key, tag.Value) - } + for _, tag := range i.tags { + properties.SetTag(tag.Key, tag.Value) + } - return properties + return properties } - func (i *DynamoDBTable) String() string { return i.id } diff --git a/resources/ec2-client-vpn-endpoint-attachments.go b/resources/ec2-client-vpn-endpoint-attachment.go similarity index 66% rename from resources/ec2-client-vpn-endpoint-attachments.go rename to resources/ec2-client-vpn-endpoint-attachment.go index dd8691b79..7c0c22e79 100644 --- a/resources/ec2-client-vpn-endpoint-attachments.go +++ b/resources/ec2-client-vpn-endpoint-attachment.go @@ -1,25 +1,35 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2ClientVpnEndpointAttachments struct { - svc *ec2.EC2 - associationId *string - clientVpnEndpointId *string - vpcId *string -} +const EC2ClientVpnEndpointAttachmentResource = "EC2ClientVpnEndpointAttachment" func init() { - register("EC2ClientVpnEndpointAttachment", ListEC2ClientVpnEndpointAttachments) + resource.Register(resource.Registration{ + Name: EC2ClientVpnEndpointAttachmentResource, + Scope: nuke.Account, + Lister: &EC2ClientVpnEndpointAttachmentLister{}, + }) } -func ListEC2ClientVpnEndpointAttachments(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2ClientVpnEndpointAttachmentLister struct{} + +func (l *EC2ClientVpnEndpointAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) endpoints := make([]*string, 0) @@ -35,7 +45,7 @@ func ListEC2ClientVpnEndpointAttachments(sess *session.Session) ([]Resource, err return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, clientVpnEndpointId := range endpoints { params := &ec2.DescribeClientVpnTargetNetworksInput{ ClientVpnEndpointId: clientVpnEndpointId, @@ -60,7 +70,14 @@ func ListEC2ClientVpnEndpointAttachments(sess *session.Session) ([]Resource, err return resources, nil } -func (e *EC2ClientVpnEndpointAttachments) Remove() error { +type EC2ClientVpnEndpointAttachments struct { + svc *ec2.EC2 + associationId *string + clientVpnEndpointId *string + vpcId *string +} + +func (e *EC2ClientVpnEndpointAttachments) Remove(_ context.Context) error { params := &ec2.DisassociateClientVpnTargetNetworkInput{ AssociationId: e.associationId, ClientVpnEndpointId: e.clientVpnEndpointId, @@ -75,5 +92,5 @@ func (e *EC2ClientVpnEndpointAttachments) Remove() error { } func (e *EC2ClientVpnEndpointAttachments) String() string { - return fmt.Sprintf("%s -> %s", *e.clientVpnEndpointId, *e.vpcId) + return fmt.Sprintf("%s -> %s", ptr.ToString(e.clientVpnEndpointId), ptr.ToString(e.vpcId)) } diff --git a/resources/ec2-client-vpn-endpoint.go b/resources/ec2-client-vpn-endpoint.go index c318505f9..f0225b849 100644 --- a/resources/ec2-client-vpn-endpoint.go +++ b/resources/ec2-client-vpn-endpoint.go @@ -1,24 +1,36 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2ClientVpnEndpoint struct { - svc *ec2.EC2 - id string - cveTags []*ec2.Tag -} +const EC2ClientVpnEndpointResource = "EC2ClientVpnEndpoint" func init() { - register("EC2ClientVpnEndpoint", ListEC2ClientVpnEndoint) + resource.Register(resource.Registration{ + Name: EC2ClientVpnEndpointResource, + Scope: nuke.Account, + Lister: &EC2ClientVpnEndpointLister{}, + DependsOn: []string{ + EC2ClientVpnEndpointAttachmentResource, + }, + }) } -func ListEC2ClientVpnEndoint(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) - resources := make([]Resource, 0) +type EC2ClientVpnEndpointLister struct{} + +func (l *EC2ClientVpnEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ec2.DescribeClientVpnEndpointsInput{} err := svc.DescribeClientVpnEndpointsPages(params, @@ -39,7 +51,13 @@ func ListEC2ClientVpnEndoint(sess *session.Session) ([]Resource, error) { return resources, nil } -func (c *EC2ClientVpnEndpoint) Remove() error { +type EC2ClientVpnEndpoint struct { + svc *ec2.EC2 + id string + cveTags []*ec2.Tag +} + +func (c *EC2ClientVpnEndpoint) Remove(_ context.Context) error { params := &ec2.DeleteClientVpnEndpointInput{ ClientVpnEndpointId: &c.id, } diff --git a/resources/ec2-customer-gateways.go b/resources/ec2-customer-gateway.go similarity index 59% rename from resources/ec2-customer-gateways.go rename to resources/ec2-customer-gateway.go index b8ce2ce06..0f9ecd136 100644 --- a/resources/ec2-customer-gateways.go +++ b/resources/ec2-customer-gateway.go @@ -1,24 +1,32 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2CustomerGateway struct { - svc *ec2.EC2 - id string - state string -} +const EC2CustomerGatewayResource = "EC2CustomerGateway" func init() { - register("EC2CustomerGateway", ListEC2CustomerGateways) + resource.Register(resource.Registration{ + Name: EC2CustomerGatewayResource, + Scope: nuke.Account, + Lister: &EC2CustomerGatewayLister{}, + }) } -func ListEC2CustomerGateways(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2CustomerGatewayLister struct{} + +func (l *EC2CustomerGatewayLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) params := &ec2.DescribeCustomerGatewaysInput{} resp, err := svc.DescribeCustomerGateways(params) @@ -26,7 +34,7 @@ func ListEC2CustomerGateways(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.CustomerGateways { resources = append(resources, &EC2CustomerGateway{ svc: svc, @@ -38,6 +46,12 @@ func ListEC2CustomerGateways(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2CustomerGateway struct { + svc *ec2.EC2 + id string + state string +} + func (c *EC2CustomerGateway) Filter() error { if c.state == "deleted" { return fmt.Errorf("already deleted") @@ -45,7 +59,7 @@ func (c *EC2CustomerGateway) Filter() error { return nil } -func (c *EC2CustomerGateway) Remove() error { +func (c *EC2CustomerGateway) Remove(_ context.Context) error { params := &ec2.DeleteCustomerGatewayInput{ CustomerGatewayId: &c.id, } diff --git a/resources/ec2-default-security-group-rules.go b/resources/ec2-default-security-group-rules.go index 71903cc08..eb52c2b2e 100644 --- a/resources/ec2-default-security-group-rules.go +++ b/resources/ec2-default-security-group-rules.go @@ -1,26 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2DefaultSecurityGroupRule struct { - svc *ec2.EC2 - id *string - groupId *string - isEgress *bool -} +const EC2DefaultSecurityGroupRuleResource = "EC2DefaultSecurityGroupRule" func init() { - register("EC2DefaultSecurityGroupRule", ListEC2SecurityGroupRules) + resource.Register(resource.Registration{ + Name: EC2DefaultSecurityGroupRuleResource, + Scope: nuke.Account, + Lister: &EC2DefaultSecurityGroupRuleLister{}, + }) } -func ListEC2SecurityGroupRules(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) - resources := make([]Resource, 0) +type EC2DefaultSecurityGroupRuleLister struct{} + +func (l *EC2DefaultSecurityGroupRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + resources := make([]resource.Resource, 0) sgFilters := []*ec2.Filter{ { @@ -73,7 +81,14 @@ func ListEC2SecurityGroupRules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *EC2DefaultSecurityGroupRule) Remove() error { +type EC2DefaultSecurityGroupRule struct { + svc *ec2.EC2 + id *string + groupId *string + isEgress *bool +} + +func (r *EC2DefaultSecurityGroupRule) Remove(_ context.Context) error { rules := make([]*string, 1) rules[0] = r.id if *r.isEgress { diff --git a/resources/ec2-dhcp-options.go b/resources/ec2-dhcp-options.go index 705865a05..5c840ed0c 100644 --- a/resources/ec2-dhcp-options.go +++ b/resources/ec2-dhcp-options.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2DHCPOption struct { - svc *ec2.EC2 - id *string - tags []*ec2.Tag - defaultVPC bool -} +const EC2DHCPOptionResource = "EC2DHCPOption" func init() { - register("EC2DHCPOption", ListEC2DHCPOptions) + resource.Register(resource.Registration{ + Name: EC2DHCPOptionResource, + Scope: nuke.Account, + Lister: &EC2DHCPOptionLister{}, + }) } -func ListEC2DHCPOptions(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2DHCPOptionLister struct{} + +func (l *EC2DHCPOptionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeDhcpOptions(&ec2.DescribeDhcpOptionsInput{}) if err != nil { @@ -27,23 +37,30 @@ func ListEC2DHCPOptions(sess *session.Session) ([]Resource, error) { defVpcDhcpOptsId := "" if defVpc := DefaultVpc(svc); defVpc != nil { - defVpcDhcpOptsId = *defVpc.DhcpOptionsId + defVpcDhcpOptsId = ptr.ToString(defVpc.DhcpOptionsId) } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.DhcpOptions { resources = append(resources, &EC2DHCPOption{ svc: svc, id: out.DhcpOptionsId, tags: out.Tags, - defaultVPC: defVpcDhcpOptsId == *out.DhcpOptionsId, + defaultVPC: defVpcDhcpOptsId == ptr.ToString(out.DhcpOptionsId), }) } return resources, nil } -func (e *EC2DHCPOption) Remove() error { +type EC2DHCPOption struct { + svc *ec2.EC2 + id *string + tags []*ec2.Tag + defaultVPC bool +} + +func (e *EC2DHCPOption) Remove(_ context.Context) error { params := &ec2.DeleteDhcpOptionsInput{ DhcpOptionsId: e.id, } @@ -66,5 +83,5 @@ func (e *EC2DHCPOption) Properties() types.Properties { } func (e *EC2DHCPOption) String() string { - return *e.id + return ptr.ToString(e.id) } diff --git a/resources/ec2-egress-only-internet-gateways.go b/resources/ec2-egress-only-internet-gateways.go index d8f81b250..398a7f637 100644 --- a/resources/ec2-egress-only-internet-gateways.go +++ b/resources/ec2-egress-only-internet-gateways.go @@ -1,24 +1,36 @@ package resources import ( + "context" + + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2EgressOnlyInternetGateway struct { - svc *ec2.EC2 - igw *ec2.EgressOnlyInternetGateway -} +const EC2EgressOnlyInternetGatewayResource = "EC2EgressOnlyInternetGateway" func init() { - register("EC2EgressOnlyInternetGateway", ListEC2EgressOnlyInternetGateways) + resource.Register(resource.Registration{ + Name: EC2EgressOnlyInternetGatewayResource, + Scope: nuke.Account, + Lister: &EC2EgressOnlyInternetGatewayLister{}, + }) } -func ListEC2EgressOnlyInternetGateways(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) - resources := make([]Resource, 0) +type EC2EgressOnlyInternetGatewayLister struct{} + +func (l *EC2EgressOnlyInternetGatewayLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + resources := make([]resource.Resource, 0) igwInputParams := &ec2.DescribeEgressOnlyInternetGatewaysInput{ MaxResults: aws.Int64(255), } @@ -46,7 +58,12 @@ func ListEC2EgressOnlyInternetGateways(sess *session.Session) ([]Resource, error return resources, nil } -func (e *EC2EgressOnlyInternetGateway) Remove() error { +type EC2EgressOnlyInternetGateway struct { + svc *ec2.EC2 + igw *ec2.EgressOnlyInternetGateway +} + +func (e *EC2EgressOnlyInternetGateway) Remove(_ context.Context) error { params := &ec2.DeleteEgressOnlyInternetGatewayInput{ EgressOnlyInternetGatewayId: e.igw.EgressOnlyInternetGatewayId, } @@ -68,5 +85,5 @@ func (e *EC2EgressOnlyInternetGateway) Properties() types.Properties { } func (e *EC2EgressOnlyInternetGateway) String() string { - return *e.igw.EgressOnlyInternetGatewayId + return ptr.ToString(e.igw.EgressOnlyInternetGatewayId) } diff --git a/resources/ec2-eip.go b/resources/ec2-eip.go index 19b0d66b3..8cf1eba83 100644 --- a/resources/ec2-eip.go +++ b/resources/ec2-eip.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2Address struct { - svc *ec2.EC2 - eip *ec2.Address - id string - ip string -} +const EC2AddressResource = "EC2Address" func init() { - register("EC2Address", ListEC2Addresses) + resource.Register(resource.Registration{ + Name: EC2AddressResource, + Scope: nuke.Account, + Lister: &EC2AddressLister{}, + }) } -func ListEC2Addresses(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2AddressLister struct{} + +func (l *EC2AddressLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) params := &ec2.DescribeAddressesInput{} resp, err := svc.DescribeAddresses(params) @@ -26,20 +36,27 @@ func ListEC2Addresses(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.Addresses { resources = append(resources, &EC2Address{ svc: svc, eip: out, - id: *out.AllocationId, - ip: *out.PublicIp, + id: ptr.ToString(out.AllocationId), + ip: ptr.ToString(out.PublicIp), }) } return resources, nil } -func (e *EC2Address) Remove() error { +type EC2Address struct { + svc *ec2.EC2 + eip *ec2.Address + id string + ip string +} + +func (e *EC2Address) Remove(_ context.Context) error { _, err := e.svc.ReleaseAddress(&ec2.ReleaseAddressInput{ AllocationId: &e.id, }) diff --git a/resources/ec2-hosts.go b/resources/ec2-host.go similarity index 70% rename from resources/ec2-hosts.go rename to resources/ec2-host.go index d49129dae..1a3b4e67a 100644 --- a/resources/ec2-hosts.go +++ b/resources/ec2-host.go @@ -1,30 +1,37 @@ package resources import ( + "context" + "fmt" "time" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) -type EC2Host struct { - svc *ec2.EC2 - host *ec2.Host + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" - featureFlags config.FeatureFlags -} + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +const EC2HostResource = "EC2Host" func init() { - register("EC2Host", ListEC2Hosts) + resource.Register(resource.Registration{ + Name: EC2HostResource, + Scope: nuke.Account, + Lister: &EC2HostLister{}, + }) } -func ListEC2Hosts(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2HostLister struct{} + +func (l *EC2HostLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) params := &ec2.DescribeHostsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.DescribeHosts(params) if err != nil { @@ -50,6 +57,11 @@ func ListEC2Hosts(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2Host struct { + svc *ec2.EC2 + host *ec2.Host +} + func (i *EC2Host) Filter() error { if *i.host.State == "released" { return fmt.Errorf("already released") @@ -57,7 +69,7 @@ func (i *EC2Host) Filter() error { return nil } -func (i *EC2Host) Remove() error { +func (i *EC2Host) Remove(_ context.Context) error { params := &ec2.ReleaseHostsInput{ HostIds: []*string{i.host.HostId}, } diff --git a/resources/ec2-images.go b/resources/ec2-image.go similarity index 65% rename from resources/ec2-images.go rename to resources/ec2-image.go index dd45de686..e042d47e5 100644 --- a/resources/ec2-images.go +++ b/resources/ec2-image.go @@ -1,26 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2Image struct { - svc *ec2.EC2 - creationDate string - id string - name string - tags []*ec2.Tag -} +const EC2ImageResource = "EC2Image" func init() { - register("EC2Image", ListEC2Images) + resource.Register(resource.Registration{ + Name: EC2ImageResource, + Scope: nuke.Account, + Lister: &EC2ImageLister{}, + }) } -func ListEC2Images(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2ImageLister struct{} + +func (l *EC2ImageLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) params := &ec2.DescribeImagesInput{ Owners: []*string{ aws.String("self"), @@ -31,7 +38,7 @@ func ListEC2Images(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.Images { resources = append(resources, &EC2Image{ svc: svc, @@ -45,7 +52,15 @@ func ListEC2Images(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EC2Image) Remove() error { +type EC2Image struct { + svc *ec2.EC2 + creationDate string + id string + name string + tags []*ec2.Tag +} + +func (e *EC2Image) Remove(_ context.Context) error { _, err := e.svc.DeregisterImage(&ec2.DeregisterImageInput{ ImageId: &e.id, }) diff --git a/resources/ec2-instances.go b/resources/ec2-instance.go similarity index 72% rename from resources/ec2-instances.go rename to resources/ec2-instance.go index 470ac5d6a..0bd8ccc4c 100644 --- a/resources/ec2-instances.go +++ b/resources/ec2-instance.go @@ -1,32 +1,39 @@ package resources import ( + "context" + + "errors" "fmt" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/featureflag" + "github.com/ekristen/libnuke/pkg/resource" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "github.com/ekristen/libnuke/pkg/types" ) -type EC2Instance struct { - svc *ec2.EC2 - instance *ec2.Instance - - featureFlags config.FeatureFlags -} +const EC2InstanceResource = "EC2Instance" func init() { - register("EC2Instance", ListEC2Instances) + resource.Register(resource.Registration{ + Name: EC2InstanceResource, + Scope: nuke.Account, + Lister: &EC2InstanceLister{}, + }) } -func ListEC2Instances(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2InstanceLister struct{} + +func (l *EC2InstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) params := &ec2.DescribeInstancesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.DescribeInstances(params) if err != nil { @@ -54,7 +61,14 @@ func ListEC2Instances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *EC2Instance) FeatureFlags(ff config.FeatureFlags) { +type EC2Instance struct { + svc *ec2.EC2 + instance *ec2.Instance + + featureFlags *featureflag.FeatureFlags +} + +func (i *EC2Instance) FeatureFlags(ff *featureflag.FeatureFlags) { i.featureFlags = ff } @@ -65,19 +79,30 @@ func (i *EC2Instance) Filter() error { return nil } -func (i *EC2Instance) Remove() error { +func (i *EC2Instance) Remove(_ context.Context) error { + ffddpEC2Instance, err := i.featureFlags.Get("DisableDeletionProtection_EC2Instance") + if err != nil { + return err + } + + ffDisableEC2InstanceStopProtection, err := i.featureFlags.Get("DisableEC2InstanceStopProtection") + if err != nil { + return err + } + params := &ec2.TerminateInstancesInput{ InstanceIds: []*string{i.instance.InstanceId}, } - _, err := i.svc.TerminateInstances(params) - if err != nil { - awsErr, ok := err.(awserr.Error) + if _, err := i.svc.TerminateInstances(params); err != nil { + var awsErr awserr.Error + ok := errors.As(err, &awsErr) + // Check for Termination Protection, disable it, and try termination again. if ok && awsErr.Code() == "OperationNotPermitted" && awsErr.Message() == "The instance '"+*i.instance.InstanceId+"' may not be "+ "terminated. Modify its 'disableApiTermination' instance attribute and "+ - "try again." && i.featureFlags.DisableDeletionProtection.EC2Instance { + "try again." && ffddpEC2Instance.Enabled() { termErr := i.DisableTerminationProtection() if termErr != nil { return termErr @@ -86,7 +111,7 @@ func (i *EC2Instance) Remove() error { // If we still get an error, we'll check for type and let the next routine // handle it. if err != nil { - awsErr, ok = err.(awserr.Error) + ok = errors.As(err, &awsErr) } } @@ -94,7 +119,7 @@ func (i *EC2Instance) Remove() error { if ok && awsErr.Code() == "OperationNotPermitted" && awsErr.Message() == "The instance '"+*i.instance.InstanceId+"' may not be "+ "terminated. Modify its 'disableApiStop' instance attribute and try "+ - "again." && i.featureFlags.DisableEC2InstanceStopProtection { + "again." && ffDisableEC2InstanceStopProtection.Enabled() { stopErr := i.DisableStopProtection() if stopErr != nil { return stopErr @@ -107,6 +132,7 @@ func (i *EC2Instance) Remove() error { return err } } + return nil } diff --git a/resources/ec2-internet-gateway-attachments.go b/resources/ec2-internet-gateway-attachments.go index 107602fd9..464c4397c 100644 --- a/resources/ec2-internet-gateway-attachments.go +++ b/resources/ec2-internet-gateway-attachments.go @@ -1,36 +1,43 @@ package resources import ( + "context" + "fmt" + "github.com/gotidy/ptr" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2InternetGatewayAttachment struct { - svc *ec2.EC2 - vpcId *string - vpcTags []*ec2.Tag - igwId *string - igwTags []*ec2.Tag - defaultVPC bool -} +const EC2InternetGatewayAttachmentResource = "EC2InternetGatewayAttachment" func init() { - register("EC2InternetGatewayAttachment", ListEC2InternetGatewayAttachments) + resource.Register(resource.Registration{ + Name: EC2InternetGatewayAttachmentResource, + Scope: nuke.Account, + Lister: &EC2InternetGatewayAttachmentLister{}, + }) } -func ListEC2InternetGatewayAttachments(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2InternetGatewayAttachmentLister struct{} + +func (l *EC2InternetGatewayAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeVpcs(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, vpc := range resp.Vpcs { params := &ec2.DescribeInternetGatewaysInput{ Filters: []*ec2.Filter{ @@ -61,7 +68,16 @@ func ListEC2InternetGatewayAttachments(sess *session.Session) ([]Resource, error return resources, nil } -func (e *EC2InternetGatewayAttachment) Remove() error { +type EC2InternetGatewayAttachment struct { + svc *ec2.EC2 + vpcId *string + vpcTags []*ec2.Tag + igwId *string + igwTags []*ec2.Tag + defaultVPC bool +} + +func (e *EC2InternetGatewayAttachment) Remove(_ context.Context) error { params := &ec2.DetachInternetGatewayInput{ VpcId: e.vpcId, InternetGatewayId: e.igwId, @@ -88,5 +104,5 @@ func (e *EC2InternetGatewayAttachment) Properties() types.Properties { } func (e *EC2InternetGatewayAttachment) String() string { - return fmt.Sprintf("%s -> %s", *e.igwId, *e.vpcId) + return fmt.Sprintf("%s -> %s", ptr.ToString(e.igwId), ptr.ToString(e.vpcId)) } diff --git a/resources/ec2-internet-gateways.go b/resources/ec2-internet-gateways.go index 15ef9a588..7c946a97e 100644 --- a/resources/ec2-internet-gateways.go +++ b/resources/ec2-internet-gateways.go @@ -1,23 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "github.com/gotidy/ptr" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2InternetGateway struct { - svc *ec2.EC2 - igw *ec2.InternetGateway - defaultVPC bool -} +const EC2InternetGatewayResource = "EC2InternetGateway" func init() { - register("EC2InternetGateway", ListEC2InternetGateways) + resource.Register(resource.Registration{ + Name: EC2InternetGatewayResource, + Scope: nuke.Account, + Lister: &EC2InternetGatewayLister{}, + }) } -func ListEC2InternetGateways(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2InternetGatewayLister struct{} + +func (l *EC2InternetGatewayLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeInternetGateways(nil) if err != nil { @@ -29,7 +39,7 @@ func ListEC2InternetGateways(sess *session.Session) ([]Resource, error) { defVpcId = *defVpc.VpcId } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, igw := range resp.InternetGateways { resources = append(resources, &EC2InternetGateway{ svc: svc, @@ -54,7 +64,13 @@ func HasVpcAttachment(vpcId *string, attachments []*ec2.InternetGatewayAttachmen return false } -func (e *EC2InternetGateway) Remove() error { +type EC2InternetGateway struct { + svc *ec2.EC2 + igw *ec2.InternetGateway + defaultVPC bool +} + +func (e *EC2InternetGateway) Remove(_ context.Context) error { params := &ec2.DeleteInternetGatewayInput{ InternetGatewayId: e.igw.InternetGatewayId, } @@ -78,5 +94,5 @@ func (e *EC2InternetGateway) Properties() types.Properties { } func (e *EC2InternetGateway) String() string { - return *e.igw.InternetGatewayId + return ptr.ToString(e.igw.InternetGatewayId) } diff --git a/resources/ec2-key-pairs.go b/resources/ec2-key-pairs.go index 2e85f622a..25830813e 100644 --- a/resources/ec2-key-pairs.go +++ b/resources/ec2-key-pairs.go @@ -1,30 +1,39 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2KeyPair struct { - svc *ec2.EC2 - name string - tags []*ec2.Tag -} +const EC2KeyPairResource = "EC2KeyPair" func init() { - register("EC2KeyPair", ListEC2KeyPairs) + resource.Register(resource.Registration{ + Name: EC2KeyPairResource, + Scope: nuke.Account, + Lister: &EC2KeyPairLister{}, + }) } -func ListEC2KeyPairs(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2KeyPairLister struct{} + +func (l *EC2KeyPairLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeKeyPairs(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.KeyPairs { resources = append(resources, &EC2KeyPair{ svc: svc, @@ -36,7 +45,13 @@ func ListEC2KeyPairs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EC2KeyPair) Remove() error { +type EC2KeyPair struct { + svc *ec2.EC2 + name string + tags []*ec2.Tag +} + +func (e *EC2KeyPair) Remove(_ context.Context) error { params := &ec2.DeleteKeyPairInput{ KeyName: &e.name, } diff --git a/resources/ec2-launch-templates.go b/resources/ec2-launch-templates.go index 2b8f4e138..063e069e5 100644 --- a/resources/ec2-launch-templates.go +++ b/resources/ec2-launch-templates.go @@ -1,30 +1,41 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2LaunchTemplate struct { - svc *ec2.EC2 - name *string - tag []*ec2.Tag -} +const EC2LaunchTemplateResource = "EC2LaunchTemplate" func init() { - register("EC2LaunchTemplate", ListEC2LaunchTemplates) + resource.Register(resource.Registration{ + Name: EC2LaunchTemplateResource, + Scope: nuke.Account, + Lister: &EC2LaunchTemplateLister{}, + }) } -func ListEC2LaunchTemplates(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2LaunchTemplateLister struct{} + +func (l *EC2LaunchTemplateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeLaunchTemplates(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, template := range resp.LaunchTemplates { resources = append(resources, &EC2LaunchTemplate{ svc: svc, @@ -35,7 +46,13 @@ func ListEC2LaunchTemplates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (template *EC2LaunchTemplate) Remove() error { +type EC2LaunchTemplate struct { + svc *ec2.EC2 + name *string + tag []*ec2.Tag +} + +func (template *EC2LaunchTemplate) Remove(_ context.Context) error { _, err := template.svc.DeleteLaunchTemplate(&ec2.DeleteLaunchTemplateInput{ LaunchTemplateName: template.name, }) @@ -52,5 +69,5 @@ func (template *EC2LaunchTemplate) Properties() types.Properties { } func (template *EC2LaunchTemplate) String() string { - return *template.name + return ptr.ToString(template.name) } diff --git a/resources/ec2-nat-gateways.go b/resources/ec2-nat-gateways.go index c69be4e28..f70c7835f 100644 --- a/resources/ec2-nat-gateways.go +++ b/resources/ec2-nat-gateways.go @@ -1,24 +1,35 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2NATGateway struct { - svc *ec2.EC2 - natgw *ec2.NatGateway -} +const EC2NATGatewayResource = "EC2NATGateway" func init() { - register("EC2NATGateway", ListEC2NATGateways) + resource.Register(resource.Registration{ + Name: EC2NATGatewayResource, + Scope: nuke.Account, + Lister: &EC2NATGatewayLister{}, + }) } -func ListEC2NATGateways(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2NATGatewayLister struct{} + +func (l *EC2NATGatewayLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) params := &ec2.DescribeNatGatewaysInput{} resp, err := svc.DescribeNatGateways(params) @@ -26,7 +37,7 @@ func ListEC2NATGateways(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, natgw := range resp.NatGateways { resources = append(resources, &EC2NATGateway{ svc: svc, @@ -37,6 +48,11 @@ func ListEC2NATGateways(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2NATGateway struct { + svc *ec2.EC2 + natgw *ec2.NatGateway +} + func (n *EC2NATGateway) Filter() error { if *n.natgw.State == "deleted" { return fmt.Errorf("already deleted") @@ -44,7 +60,7 @@ func (n *EC2NATGateway) Filter() error { return nil } -func (n *EC2NATGateway) Remove() error { +func (n *EC2NATGateway) Remove(_ context.Context) error { params := &ec2.DeleteNatGatewayInput{ NatGatewayId: n.natgw.NatGatewayId, } @@ -66,5 +82,5 @@ func (n *EC2NATGateway) Properties() types.Properties { } func (n *EC2NATGateway) String() string { - return *n.natgw.NatGatewayId + return ptr.ToString(n.natgw.NatGatewayId) } diff --git a/resources/ec2-network-acls.go b/resources/ec2-network-acls.go index 4d3c6ed88..9ccc246a6 100644 --- a/resources/ec2-network-acls.go +++ b/resources/ec2-network-acls.go @@ -1,34 +1,43 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2NetworkACL struct { - svc *ec2.EC2 - id *string - isDefault *bool - tags []*ec2.Tag - ownerID *string -} +const EC2NetworkACLResource = "EC2NetworkACL" func init() { - register("EC2NetworkACL", ListEC2NetworkACLs) + resource.Register(resource.Registration{ + Name: EC2NetworkACLResource, + Scope: nuke.Account, + Lister: &EC2NetworkACLLister{}, + }) } -func ListEC2NetworkACLs(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2NetworkACLLister struct{} + +func (l *EC2NetworkACLLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeNetworkAcls(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.NetworkAcls { resources = append(resources, &EC2NetworkACL{ @@ -43,15 +52,23 @@ func ListEC2NetworkACLs(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2NetworkACL struct { + svc *ec2.EC2 + id *string + isDefault *bool + tags []*ec2.Tag + ownerID *string +} + func (e *EC2NetworkACL) Filter() error { - if *e.isDefault { + if ptr.ToBool(e.isDefault) { return fmt.Errorf("cannot delete default VPC") } return nil } -func (e *EC2NetworkACL) Remove() error { +func (e *EC2NetworkACL) Remove(_ context.Context) error { params := &ec2.DeleteNetworkAclInput{ NetworkAclId: e.id, } @@ -64,16 +81,16 @@ func (e *EC2NetworkACL) Remove() error { return nil } -func (f *EC2NetworkACL) Properties() types.Properties { +func (e *EC2NetworkACL) Properties() types.Properties { properties := types.NewProperties() - for _, tag := range f.tags { + for _, tag := range e.tags { properties.SetTag(tag.Key, tag.Value) } - properties.Set("ID", f.id) - properties.Set("OwnerID", f.ownerID) + properties.Set("ID", e.id) + properties.Set("OwnerID", e.ownerID) return properties } func (e *EC2NetworkACL) String() string { - return *e.id + return ptr.ToString(e.id) } diff --git a/resources/ec2-network-interfaces.go b/resources/ec2-network-interfaces.go index c9ed6cfe0..458689e58 100644 --- a/resources/ec2-network-interfaces.go +++ b/resources/ec2-network-interfaces.go @@ -1,33 +1,43 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2NetworkInterface struct { - svc *ec2.EC2 - eni *ec2.NetworkInterface -} +const EC2NetworkInterfaceResource = "EC2NetworkInterface" func init() { - register("EC2NetworkInterface", ListEC2NetworkInterfaces) + resource.Register(resource.Registration{ + Name: EC2NetworkInterfaceResource, + Scope: nuke.Account, + Lister: &EC2NetworkInterfaceLister{}, + }) } -func ListEC2NetworkInterfaces(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2NetworkInterfaceLister struct{} + +func (l *EC2NetworkInterfaceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeNetworkInterfaces(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.NetworkInterfaces { resources = append(resources, &EC2NetworkInterface{ @@ -39,8 +49,12 @@ func ListEC2NetworkInterfaces(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EC2NetworkInterface) Remove() error { +type EC2NetworkInterface struct { + svc *ec2.EC2 + eni *ec2.NetworkInterface +} +func (e *EC2NetworkInterface) Remove(_ context.Context) error { if e.eni.Attachment != nil { _, err := e.svc.DetachNetworkInterface(&ec2.DetachNetworkInterfaceInput{ AttachmentId: e.eni.Attachment.AttachmentId, @@ -69,21 +83,21 @@ func (e *EC2NetworkInterface) Remove() error { return nil } -func (r *EC2NetworkInterface) Properties() types.Properties { +func (e *EC2NetworkInterface) Properties() types.Properties { properties := types.NewProperties() - for _, tag := range r.eni.TagSet { + for _, tag := range e.eni.TagSet { properties.SetTag(tag.Key, tag.Value) } properties. - Set("ID", r.eni.NetworkInterfaceId). - Set("VPC", r.eni.VpcId). - Set("AvailabilityZone", r.eni.AvailabilityZone). - Set("PrivateIPAddress", r.eni.PrivateIpAddress). - Set("SubnetID", r.eni.SubnetId). - Set("Status", r.eni.Status) + Set("ID", e.eni.NetworkInterfaceId). + Set("VPC", e.eni.VpcId). + Set("AvailabilityZone", e.eni.AvailabilityZone). + Set("PrivateIPAddress", e.eni.PrivateIpAddress). + Set("SubnetID", e.eni.SubnetId). + Set("Status", e.eni.Status) return properties } -func (r *EC2NetworkInterface) String() string { - return *r.eni.NetworkInterfaceId +func (e *EC2NetworkInterface) String() string { + return *e.eni.NetworkInterfaceId } diff --git a/resources/ec2-placement-groups.go b/resources/ec2-placement-groups.go index 302b970ad..e7019307e 100644 --- a/resources/ec2-placement-groups.go +++ b/resources/ec2-placement-groups.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2PlacementGroup struct { - svc *ec2.EC2 - name string - state string -} +const EC2PlacementGroupResource = "EC2PlacementGroup" func init() { - register("EC2PlacementGroup", ListEC2PlacementGroups) + resource.Register(resource.Registration{ + Name: EC2PlacementGroupResource, + Scope: nuke.Account, + Lister: &EC2PlacementGroupLister{}, + }) } -func ListEC2PlacementGroups(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2PlacementGroupLister struct{} + +func (l *EC2PlacementGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) params := &ec2.DescribePlacementGroupsInput{} resp, err := svc.DescribePlacementGroups(params) @@ -26,7 +35,7 @@ func ListEC2PlacementGroups(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.PlacementGroups { resources = append(resources, &EC2PlacementGroup{ svc: svc, @@ -38,6 +47,12 @@ func ListEC2PlacementGroups(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2PlacementGroup struct { + svc *ec2.EC2 + name string + state string +} + func (p *EC2PlacementGroup) Filter() error { if p.state == "deleted" { return fmt.Errorf("already deleted") @@ -45,7 +60,7 @@ func (p *EC2PlacementGroup) Filter() error { return nil } -func (p *EC2PlacementGroup) Remove() error { +func (p *EC2PlacementGroup) Remove(_ context.Context) error { params := &ec2.DeletePlacementGroupInput{ GroupName: &p.name, } diff --git a/resources/ec2-route-tables.go b/resources/ec2-route-tables.go index e8313c360..da4618a40 100644 --- a/resources/ec2-route-tables.go +++ b/resources/ec2-route-tables.go @@ -1,23 +1,45 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "fmt" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const EC2RouteTableResource = "EC2RouteTable" + +func init() { + resource.Register(resource.Registration{ + Name: EC2RouteTableResource, + Scope: nuke.Account, + Lister: &EC2RouteTableLister{}, + DependsOn: []string{ + EC2SubnetResource, + }, + }) +} + type EC2RouteTable struct { svc *ec2.EC2 routeTable *ec2.RouteTable defaultVPC bool + vpc *ec2.Vpc } -func init() { - register("EC2RouteTable", ListEC2RouteTables) -} +type EC2RouteTableLister struct{} + +func (l *EC2RouteTableLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) -func ListEC2RouteTables(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) + svc := ec2.New(opts.Session) resp, err := svc.DescribeRouteTables(nil) if err != nil { @@ -26,22 +48,38 @@ func ListEC2RouteTables(sess *session.Session) ([]Resource, error) { defVpcId := "" if defVpc := DefaultVpc(svc); defVpc != nil { - defVpcId = *defVpc.VpcId + defVpcId = ptr.ToString(defVpc.VpcId) } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.RouteTables { + vpc, err := GetVPC(svc, out.VpcId) + if err != nil { + return resources, nil + } + resources = append(resources, &EC2RouteTable{ svc: svc, routeTable: out, - defaultVPC: defVpcId == *out.VpcId, + defaultVPC: defVpcId == ptr.ToString(out.VpcId), + vpc: vpc, }) } return resources, nil } -func (e *EC2RouteTable) Remove() error { +func (e *EC2RouteTable) Filter() error { + for _, association := range e.routeTable.Associations { + if *association.Main { + return fmt.Errorf("main route tables cannot be deleted") + } + } + + return nil +} + +func (e *EC2RouteTable) Remove(_ context.Context) error { params := &ec2.DeleteRouteTableInput{ RouteTableId: e.routeTable.RouteTableId, } @@ -56,13 +94,21 @@ func (e *EC2RouteTable) Remove() error { func (e *EC2RouteTable) Properties() types.Properties { properties := types.NewProperties() + + properties.Set("DefaultVPC", e.defaultVPC) + properties.Set("vpcID", e.routeTable.VpcId) + for _, tagValue := range e.routeTable.Tags { properties.SetTag(tagValue.Key, tagValue.Value) } - properties.Set("DefaultVPC", e.defaultVPC) + + for _, tagValue := range e.vpc.Tags { + properties.SetTagWithPrefix("vpc", tagValue.Key, tagValue.Value) + } + return properties } func (e *EC2RouteTable) String() string { - return *e.routeTable.RouteTableId + return ptr.ToString(e.routeTable.RouteTableId) } diff --git a/resources/ec2-security-groups.go b/resources/ec2-security-groups.go index 6792ac929..f0a28d8d1 100644 --- a/resources/ec2-security-groups.go +++ b/resources/ec2-security-groups.go @@ -1,13 +1,34 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" ) +const EC2SecurityGroupResource = "EC2SecurityGroup" + +func init() { + resource.Register(resource.Registration{ + Name: EC2SecurityGroupResource, + Scope: nuke.Account, + Lister: &EC2SecurityGroupLister{}, + DependsOn: []string{ + ELBv2Resource, + EC2DefaultSecurityGroupRuleResource, + }, + }) +} + type EC2SecurityGroup struct { svc *ec2.EC2 group *ec2.SecurityGroup @@ -18,16 +39,16 @@ type EC2SecurityGroup struct { ownerID *string } -func init() { - register("EC2SecurityGroup", ListEC2SecurityGroups) -} +type EC2SecurityGroupLister struct{} -func ListEC2SecurityGroups(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) - resources := make([]Resource, 0) +func (l *EC2SecurityGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ec2.DescribeSecurityGroupsInput{} - err := svc.DescribeSecurityGroupsPages(params, + if err := svc.DescribeSecurityGroupsPages(params, func(page *ec2.DescribeSecurityGroupsOutput, lastPage bool) bool { for _, group := range page.SecurityGroups { resources = append(resources, &EC2SecurityGroup{ @@ -41,9 +62,7 @@ func ListEC2SecurityGroups(sess *session.Session) ([]Resource, error) { }) } return !lastPage - }) - - if err != nil { + }); err != nil { return nil, err } @@ -51,14 +70,14 @@ func ListEC2SecurityGroups(sess *session.Session) ([]Resource, error) { } func (sg *EC2SecurityGroup) Filter() error { - if *sg.name == "default" { + if ptr.ToString(sg.name) == "default" { return fmt.Errorf("cannot delete group 'default'") } return nil } -func (sg *EC2SecurityGroup) Remove() error { +func (sg *EC2SecurityGroup) Remove(_ context.Context) error { if len(sg.egress) > 0 { egressParams := &ec2.RevokeSecurityGroupEgressInput{ GroupId: sg.id, @@ -100,5 +119,5 @@ func (sg *EC2SecurityGroup) Properties() types.Properties { } func (sg *EC2SecurityGroup) String() string { - return *sg.id + return ptr.ToString(sg.id) } diff --git a/resources/ec2-snapshots.go b/resources/ec2-snapshots.go index 4460c53ab..911ba1dca 100644 --- a/resources/ec2-snapshots.go +++ b/resources/ec2-snapshots.go @@ -1,28 +1,36 @@ package resources import ( + "context" + "fmt" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2Snapshot struct { - svc *ec2.EC2 - id string - startTime *time.Time - tags []*ec2.Tag -} +const EC2SnapshotResource = "EC2Snapshot" func init() { - register("EC2Snapshot", ListEC2Snapshots) + resource.Register(resource.Registration{ + Name: EC2SnapshotResource, + Scope: nuke.Account, + Lister: &EC2SnapshotLister{}, + }) } -func ListEC2Snapshots(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2SnapshotLister struct{} + +func (l *EC2SnapshotLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) params := &ec2.DescribeSnapshotsInput{ OwnerIds: []*string{ aws.String("self"), @@ -33,7 +41,7 @@ func ListEC2Snapshots(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.Snapshots { resources = append(resources, &EC2Snapshot{ svc: svc, @@ -46,6 +54,13 @@ func ListEC2Snapshots(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2Snapshot struct { + svc *ec2.EC2 + id string + startTime *time.Time + tags []*ec2.Tag +} + func (e *EC2Snapshot) Properties() types.Properties { properties := types.NewProperties() properties.Set("StartTime", e.startTime.Format(time.RFC3339)) @@ -56,7 +71,7 @@ func (e *EC2Snapshot) Properties() types.Properties { return properties } -func (e *EC2Snapshot) Remove() error { +func (e *EC2Snapshot) Remove(_ context.Context) error { _, err := e.svc.DeleteSnapshot(&ec2.DeleteSnapshotInput{ SnapshotId: &e.id, }) diff --git a/resources/ec2-spot-fleet-requests.go b/resources/ec2-spot-fleet-requests.go index 109a4e1f4..57f75d7cf 100644 --- a/resources/ec2-spot-fleet-requests.go +++ b/resources/ec2-spot-fleet-requests.go @@ -1,32 +1,41 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2SpotFleetRequest struct { - svc *ec2.EC2 - id string - state string -} +const EC2SpotFleetRequestResource = "EC2SpotFleetRequest" func init() { - register("EC2SpotFleetRequest", ListEC2SpotFleetRequests) + resource.Register(resource.Registration{ + Name: EC2SpotFleetRequestResource, + Scope: nuke.Account, + Lister: &EC2SpotFleetRequestLister{}, + }) } -func ListEC2SpotFleetRequests(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2SpotFleetRequestLister struct{} + +func (l *EC2SpotFleetRequestLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) resp, err := svc.DescribeSpotFleetRequests(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, config := range resp.SpotFleetRequestConfigs { resources = append(resources, &EC2SpotFleetRequest{ svc: svc, @@ -38,6 +47,12 @@ func ListEC2SpotFleetRequests(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2SpotFleetRequest struct { + svc *ec2.EC2 + id string + state string +} + func (i *EC2SpotFleetRequest) Filter() error { if i.state == "cancelled" { return fmt.Errorf("already cancelled") @@ -45,7 +60,7 @@ func (i *EC2SpotFleetRequest) Filter() error { return nil } -func (i *EC2SpotFleetRequest) Remove() error { +func (i *EC2SpotFleetRequest) Remove(_ context.Context) error { params := &ec2.CancelSpotFleetRequestsInput{ TerminateInstances: aws.Bool(true), SpotFleetRequestIds: []*string{ diff --git a/resources/ec2-subnets.go b/resources/ec2-subnets.go index 599adff66..7d3764eef 100644 --- a/resources/ec2-subnets.go +++ b/resources/ec2-subnets.go @@ -1,23 +1,41 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const EC2SubnetResource = "EC2Subnet" + +func init() { + resource.Register(resource.Registration{ + Name: EC2SubnetResource, + Scope: nuke.Account, + Lister: &EC2SubnetLister{}, + DependsOn: []string{ + EC2NetworkInterfaceResource, + }, + }) +} + type EC2Subnet struct { svc *ec2.EC2 subnet *ec2.Subnet defaultVPC bool } -func init() { - register("EC2Subnet", ListEC2Subnets) -} +type EC2SubnetLister struct{} + +func (l *EC2SubnetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) -func ListEC2Subnets(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) + svc := ec2.New(opts.Session) params := &ec2.DescribeSubnetsInput{} resp, err := svc.DescribeSubnets(params) @@ -30,7 +48,7 @@ func ListEC2Subnets(sess *session.Session) ([]Resource, error) { defVpcId = *defVpc.VpcId } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.Subnets { resources = append(resources, &EC2Subnet{ svc: svc, @@ -42,7 +60,7 @@ func ListEC2Subnets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EC2Subnet) Remove() error { +func (e *EC2Subnet) Remove(_ context.Context) error { params := &ec2.DeleteSubnetInput{ SubnetId: e.subnet.SubnetId, } @@ -57,12 +75,16 @@ func (e *EC2Subnet) Remove() error { func (e *EC2Subnet) Properties() types.Properties { properties := types.NewProperties() - for _, tagValue := range e.subnet.Tags { - properties.SetTag(tagValue.Key, tagValue.Value) - } + properties.Set("DefaultForAz", e.subnet.DefaultForAz) properties.Set("DefaultVPC", e.defaultVPC) properties.Set("OwnerID", e.subnet.OwnerId) + properties.Set("VpcID", e.subnet.VpcId) + + for _, tagValue := range e.subnet.Tags { + properties.SetTag(tagValue.Key, tagValue.Value) + } + return properties } diff --git a/resources/ec2-tgw-attachments.go b/resources/ec2-tgw-attachments.go index ca7dc3696..01944696c 100644 --- a/resources/ec2-tgw-attachments.go +++ b/resources/ec2-tgw-attachments.go @@ -1,26 +1,37 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2TGWAttachment struct { - svc *ec2.EC2 - tgwa *ec2.TransitGatewayAttachment -} +const EC2TGWAttachmentResource = "EC2TGWAttachment" func init() { - register("EC2TGWAttachment", ListEC2TGWAttachments) + resource.Register(resource.Registration{ + Name: EC2TGWAttachmentResource, + Scope: nuke.Account, + Lister: &EC2TGWAttachmentLister{}, + }) } -func ListEC2TGWAttachments(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2TGWAttachmentLister struct{} + +func (l *EC2TGWAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + params := &ec2.DescribeTransitGatewayAttachmentsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.DescribeTransitGatewayAttachments(params) if err != nil { @@ -46,7 +57,12 @@ func ListEC2TGWAttachments(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EC2TGWAttachment) Remove() error { +type EC2TGWAttachment struct { + svc *ec2.EC2 + tgwa *ec2.TransitGatewayAttachment +} + +func (e *EC2TGWAttachment) Remove(_ context.Context) error { if *e.tgwa.ResourceType == "VPN" { // This will get deleted as part of EC2VPNConnection, there is no API // as part of TGW to delete VPN attachments. diff --git a/resources/ec2-tgw.go b/resources/ec2-tgw.go index e247bc5c8..7028467c9 100644 --- a/resources/ec2-tgw.go +++ b/resources/ec2-tgw.go @@ -1,26 +1,40 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2TGW struct { - svc *ec2.EC2 - tgw *ec2.TransitGateway -} +const EC2TGWResource = "EC2TGW" func init() { - register("EC2TGW", ListEC2TGWs) + resource.Register(resource.Registration{ + Name: EC2TGWResource, + Scope: nuke.Account, + Lister: &EC2TGWLister{}, + DependsOn: []string{ + EC2TGWAttachmentResource, + }, + }) } -func ListEC2TGWs(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2TGWLister struct{} + +func (l *EC2TGWLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + params := &ec2.DescribeTransitGatewaysInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.DescribeTransitGateways(params) if err != nil { @@ -46,7 +60,12 @@ func ListEC2TGWs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EC2TGW) Remove() error { +type EC2TGW struct { + svc *ec2.EC2 + tgw *ec2.TransitGateway +} + +func (e *EC2TGW) Remove(_ context.Context) error { params := &ec2.DeleteTransitGatewayInput{ TransitGatewayId: e.tgw.TransitGatewayId, } diff --git a/resources/ec2-volume.go b/resources/ec2-volume.go index 589571205..da217d09f 100644 --- a/resources/ec2-volume.go +++ b/resources/ec2-volume.go @@ -1,29 +1,44 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const EC2VolumeResource = "EC2Volume" + +func init() { + resource.Register(resource.Registration{ + Name: EC2VolumeResource, + Scope: nuke.Account, + Lister: &EC2VolumeLister{}, + }) +} + type EC2Volume struct { svc *ec2.EC2 volume *ec2.Volume } -func init() { - register("EC2Volume", ListEC2Volumes) -} +type EC2VolumeLister struct{} + +func (l *EC2VolumeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) -func ListEC2Volumes(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) + svc := ec2.New(opts.Session) resp, err := svc.DescribeVolumes(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.Volumes { resources = append(resources, &EC2Volume{ svc: svc, @@ -34,7 +49,7 @@ func ListEC2Volumes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EC2Volume) Remove() error { +func (e *EC2Volume) Remove(_ context.Context) error { _, err := e.svc.DeleteVolume(&ec2.DeleteVolumeInput{ VolumeId: e.volume.VolumeId, }) diff --git a/resources/ec2-vpc-endpoint-connections.go b/resources/ec2-vpc-endpoint-connections.go index 68c67dd2d..dc4b313cd 100644 --- a/resources/ec2-vpc-endpoint-connections.go +++ b/resources/ec2-vpc-endpoint-connections.go @@ -1,29 +1,36 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2VPCEndpointConnection struct { - svc *ec2.EC2 - serviceID *string - vpcEndpointID *string - state *string - owner *string -} +const EC2VPCEndpointConnectionResource = "EC2VPCEndpointConnection" func init() { - register("EC2VPCEndpointConnection", ListEC2VPCEndpointConnections) + resource.Register(resource.Registration{ + Name: EC2VPCEndpointConnectionResource, + Scope: nuke.Account, + Lister: &EC2VPCEndpointConnectionLister{}, + }) } -func ListEC2VPCEndpointConnections(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) - resources := make([]Resource, 0) +type EC2VPCEndpointConnectionLister struct{} + +func (l *EC2VPCEndpointConnectionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ec2.DescribeVpcEndpointConnectionsInput{ MaxResults: aws.Int64(100), } @@ -54,6 +61,14 @@ func ListEC2VPCEndpointConnections(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2VPCEndpointConnection struct { + svc *ec2.EC2 + serviceID *string + vpcEndpointID *string + state *string + owner *string +} + func (c *EC2VPCEndpointConnection) Filter() error { if *c.state == "deleting" || *c.state == "deleted" { return fmt.Errorf("already deleted") @@ -61,7 +76,7 @@ func (c *EC2VPCEndpointConnection) Filter() error { return nil } -func (c *EC2VPCEndpointConnection) Remove() error { +func (c *EC2VPCEndpointConnection) Remove(_ context.Context) error { params := &ec2.RejectVpcEndpointConnectionsInput{ ServiceId: c.serviceID, VpcEndpointIds: []*string{ diff --git a/resources/ec2-vpc-endpoint-service-configurations.go b/resources/ec2-vpc-endpoint-service-configurations.go index 8b51aae3f..89379f42d 100644 --- a/resources/ec2-vpc-endpoint-service-configurations.go +++ b/resources/ec2-vpc-endpoint-service-configurations.go @@ -1,25 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2VPCEndpointServiceConfiguration struct { - svc *ec2.EC2 - id *string - name *string -} +const EC2VPCEndpointServiceConfigurationResource = "EC2VPCEndpointServiceConfiguration" func init() { - register("EC2VPCEndpointServiceConfiguration", ListEC2VPCEndpointServiceConfigurations) + resource.Register(resource.Registration{ + Name: EC2VPCEndpointServiceConfigurationResource, + Scope: nuke.Account, + Lister: &EC2VPCEndpointServiceConfigurationLister{}, + }) } -func ListEC2VPCEndpointServiceConfigurations(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) - resources := make([]Resource, 0) +type EC2VPCEndpointServiceConfigurationLister struct{} + +func (l *EC2VPCEndpointServiceConfigurationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ec2.DescribeVpcEndpointServiceConfigurationsInput{ MaxResults: aws.Int64(100), @@ -49,7 +57,13 @@ func ListEC2VPCEndpointServiceConfigurations(sess *session.Session) ([]Resource, return resources, nil } -func (e *EC2VPCEndpointServiceConfiguration) Remove() error { +type EC2VPCEndpointServiceConfiguration struct { + svc *ec2.EC2 + id *string + name *string +} + +func (e *EC2VPCEndpointServiceConfiguration) Remove(_ context.Context) error { params := &ec2.DeleteVpcEndpointServiceConfigurationsInput{ ServiceIds: []*string{e.id}, } diff --git a/resources/ec2-vpcEndpoint.go b/resources/ec2-vpc-endpoint.go similarity index 55% rename from resources/ec2-vpcEndpoint.go rename to resources/ec2-vpc-endpoint.go index 9cb1c3f6e..3db5dc57c 100644 --- a/resources/ec2-vpcEndpoint.go +++ b/resources/ec2-vpc-endpoint.go @@ -1,31 +1,43 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2VPCEndpoint struct { - svc *ec2.EC2 - id *string - tags []*ec2.Tag -} +const EC2VPCEndpointResource = "EC2VPCEndpoint" func init() { - register("EC2VPCEndpoint", ListEC2VPCEndpoints) + resource.Register(resource.Registration{ + Name: EC2VPCEndpointResource, + Scope: nuke.Account, + Lister: &EC2VPCEndpointLister{}, + DependsOn: []string{ + EC2VPCEndpointConnectionResource, + EC2VPCEndpointServiceConfigurationResource, + }, + }) } -func ListEC2VPCEndpoints(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2VPCEndpointLister struct{} + +func (l *EC2VPCEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) resp, err := svc.DescribeVpcs(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, vpc := range resp.Vpcs { params := &ec2.DescribeVpcEndpointsInput{ Filters: []*ec2.Filter{ @@ -53,12 +65,18 @@ func ListEC2VPCEndpoints(sess *session.Session) ([]Resource, error) { return resources, nil } -func (endpoint *EC2VPCEndpoint) Remove() error { +type EC2VPCEndpoint struct { + svc *ec2.EC2 + id *string + tags []*ec2.Tag +} + +func (e *EC2VPCEndpoint) Remove(_ context.Context) error { params := &ec2.DeleteVpcEndpointsInput{ - VpcEndpointIds: []*string{endpoint.id}, + VpcEndpointIds: []*string{e.id}, } - _, err := endpoint.svc.DeleteVpcEndpoints(params) + _, err := e.svc.DeleteVpcEndpoints(params) if err != nil { return err } @@ -74,6 +92,6 @@ func (e *EC2VPCEndpoint) Properties() types.Properties { return properties } -func (endpoint *EC2VPCEndpoint) String() string { - return *endpoint.id +func (e *EC2VPCEndpoint) String() string { + return *e.id } diff --git a/resources/ec2-vpc-peering-connections.go b/resources/ec2-vpc-peering-connections.go index 1c79119e4..47d9e042a 100644 --- a/resources/ec2-vpc-peering-connections.go +++ b/resources/ec2-vpc-peering-connections.go @@ -1,27 +1,36 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2VPCPeeringConnection struct { - svc *ec2.EC2 - id *string - status *string -} +const EC2VPCPeeringConnectionResource = "EC2VPCPeeringConnection" func init() { - register("EC2VPCPeeringConnection", ListEC2VPCPeeringConnections) + resource.Register(resource.Registration{ + Name: EC2VPCPeeringConnectionResource, + Scope: nuke.Account, + Lister: &EC2VPCPeeringConnectionLister{}, + }) } -func ListEC2VPCPeeringConnections(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) - resources := make([]Resource, 0) +type EC2VPCPeeringConnectionLister struct{} - // filter should be set as deleted vpc connetions are returned +func (l *EC2VPCPeeringConnectionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ec2.New(opts.Session) + resources := make([]resource.Resource, 0) + + // filter should be set as deleted vpc connections are returned params := &ec2.DescribeVpcPeeringConnectionsInput{} resp, err := svc.DescribeVpcPeeringConnections(params) @@ -40,6 +49,12 @@ func ListEC2VPCPeeringConnections(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2VPCPeeringConnection struct { + svc *ec2.EC2 + id *string + status *string +} + func (p *EC2VPCPeeringConnection) Filter() error { if *p.status == "deleting" || *p.status == "deleted" { return fmt.Errorf("already deleted") @@ -47,7 +62,7 @@ func (p *EC2VPCPeeringConnection) Filter() error { return nil } -func (p *EC2VPCPeeringConnection) Remove() error { +func (p *EC2VPCPeeringConnection) Remove(_ context.Context) error { params := &ec2.DeleteVpcPeeringConnectionInput{ VpcPeeringConnectionId: p.id, } diff --git a/resources/ec2-vpc.go b/resources/ec2-vpc.go index 4e9efc0c7..9e7c19c55 100644 --- a/resources/ec2-vpc.go +++ b/resources/ec2-vpc.go @@ -1,31 +1,56 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const EC2VPCResource = "EC2VPC" + +func init() { + resource.Register(resource.Registration{ + Name: EC2VPCResource, + Scope: nuke.Account, + Lister: &EC2VPCLister{}, + DependsOn: []string{ + EC2SubnetResource, + EC2RouteTableResource, + EC2DHCPOptionResource, + EC2NetworkACLResource, + EC2NetworkInterfaceResource, + EC2InternetGatewayAttachmentResource, + EC2VPCEndpointResource, + EC2VPCPeeringConnectionResource, + EC2VPNGatewayResource, + EC2EgressOnlyInternetGatewayResource, + }, + }, nuke.MapCloudControl("AWS::EC2::VPC")) +} + type EC2VPC struct { svc *ec2.EC2 vpc *ec2.Vpc } -func init() { - register("EC2VPC", ListEC2VPCs, - mapCloudControl("AWS::EC2::VPC")) -} +type EC2VPCLister struct{} -func ListEC2VPCs(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +func (l *EC2VPCLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) resp, err := svc.DescribeVpcs(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, vpc := range resp.Vpcs { resources = append(resources, &EC2VPC{ svc: svc, @@ -36,27 +61,7 @@ func ListEC2VPCs(sess *session.Session) ([]Resource, error) { return resources, nil } -func DefaultVpc(svc *ec2.EC2) *ec2.Vpc { - resp, err := svc.DescribeVpcs(&ec2.DescribeVpcsInput{ - Filters: []*ec2.Filter{ - { - Name: aws.String("is-default"), - Values: aws.StringSlice([]string{"true"}), - }, - }, - }) - if err != nil { - return nil - } - - if len(resp.Vpcs) == 0 { - return nil - } - - return resp.Vpcs[0] -} - -func (e *EC2VPC) Remove() error { +func (e *EC2VPC) Remove(_ context.Context) error { params := &ec2.DeleteVpcInput{ VpcId: e.vpc.VpcId, } @@ -83,3 +88,38 @@ func (e *EC2VPC) Properties() types.Properties { func (e *EC2VPC) String() string { return *e.vpc.VpcId } + +func DefaultVpc(svc *ec2.EC2) *ec2.Vpc { + resp, err := svc.DescribeVpcs(&ec2.DescribeVpcsInput{ + Filters: []*ec2.Filter{ + { + Name: aws.String("is-default"), + Values: aws.StringSlice([]string{"true"}), + }, + }, + }) + if err != nil { + return nil + } + + if len(resp.Vpcs) == 0 { + return nil + } + + return resp.Vpcs[0] +} + +func GetVPC(svc *ec2.EC2, vpcID *string) (*ec2.Vpc, error) { + resp, err := svc.DescribeVpcs(&ec2.DescribeVpcsInput{ + VpcIds: []*string{vpcID}, + }) + if err != nil { + return nil, err + } + + if len(resp.Vpcs) == 0 { + return nil, nil + } + + return resp.Vpcs[0], nil +} diff --git a/resources/ec2-vpn-connections.go b/resources/ec2-vpn-connections.go index be78228b5..dd701a5fd 100644 --- a/resources/ec2-vpn-connections.go +++ b/resources/ec2-vpn-connections.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2VPNConnection struct { - svc *ec2.EC2 - conn *ec2.VpnConnection -} +const EC2VPNConnectionResource = "EC2VPNConnection" func init() { - register("EC2VPNConnection", ListEC2VPNConnections) + resource.Register(resource.Registration{ + Name: EC2VPNConnectionResource, + Scope: nuke.Account, + Lister: &EC2VPNConnectionLister{}, + }) } -func ListEC2VPNConnections(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2VPNConnectionLister struct{} + +func (l *EC2VPNConnectionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) params := &ec2.DescribeVpnConnectionsInput{} resp, err := svc.DescribeVpnConnections(params) @@ -26,17 +35,22 @@ func ListEC2VPNConnections(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.VpnConnections { resources = append(resources, &EC2VPNConnection{ - svc: svc, - conn: out, + svc: svc, + conn: out, }) } return resources, nil } +type EC2VPNConnection struct { + svc *ec2.EC2 + conn *ec2.VpnConnection +} + func (v *EC2VPNConnection) Filter() error { if *v.conn.State == "deleted" { return fmt.Errorf("already deleted") @@ -44,7 +58,7 @@ func (v *EC2VPNConnection) Filter() error { return nil } -func (v *EC2VPNConnection) Remove() error { +func (v *EC2VPNConnection) Remove(_ context.Context) error { params := &ec2.DeleteVpnConnectionInput{ VpnConnectionId: v.conn.VpnConnectionId, } diff --git a/resources/ec2-vpn-gateway-attachments.go b/resources/ec2-vpn-gateway-attachments.go index 5a5e59807..5d0d93ca1 100644 --- a/resources/ec2-vpn-gateway-attachments.go +++ b/resources/ec2-vpn-gateway-attachments.go @@ -1,36 +1,41 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2VPNGatewayAttachment struct { - svc *ec2.EC2 - vpcId string - vpnId string - state string - vpcTags []*ec2.Tag - vgwTags []*ec2.Tag -} +const EC2VPNGatewayAttachmentResource = "EC2VPNGatewayAttachment" func init() { - register("EC2VPNGatewayAttachment", ListEC2VPNGatewayAttachments) + resource.Register(resource.Registration{ + Name: EC2VPNGatewayAttachmentResource, + Scope: nuke.Account, + Lister: &EC2VPNGatewayAttachmentLister{}, + }) } -func ListEC2VPNGatewayAttachments(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2VPNGatewayAttachmentLister struct{} + +func (l *EC2VPNGatewayAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) resp, err := svc.DescribeVpcs(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, vpc := range resp.Vpcs { params := &ec2.DescribeVpnGatewaysInput{ Filters: []*ec2.Filter{ @@ -60,6 +65,15 @@ func ListEC2VPNGatewayAttachments(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2VPNGatewayAttachment struct { + svc *ec2.EC2 + vpcId string + vpnId string + state string + vpcTags []*ec2.Tag + vgwTags []*ec2.Tag +} + func (v *EC2VPNGatewayAttachment) Filter() error { if v.state == "detached" { return fmt.Errorf("already detached") @@ -67,7 +81,7 @@ func (v *EC2VPNGatewayAttachment) Filter() error { return nil } -func (v *EC2VPNGatewayAttachment) Remove() error { +func (v *EC2VPNGatewayAttachment) Remove(_ context.Context) error { params := &ec2.DetachVpnGatewayInput{ VpcId: &v.vpcId, VpnGatewayId: &v.vpnId, diff --git a/resources/ec2-vpn-gateways.go b/resources/ec2-vpn-gateways.go index 0b0321dfc..dd76afdfd 100644 --- a/resources/ec2-vpn-gateways.go +++ b/resources/ec2-vpn-gateways.go @@ -1,24 +1,35 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EC2VPNGateway struct { - svc *ec2.EC2 - id string - state string -} +const EC2VPNGatewayResource = "EC2VPNGateway" func init() { - register("EC2VPNGateway", ListEC2VPNGateways) + resource.Register(resource.Registration{ + Name: EC2VPNGatewayResource, + Scope: nuke.Account, + Lister: &EC2VPNGatewayLister{}, + DependsOn: []string{ + EC2VPNGatewayAttachmentResource, + }, + }) } -func ListEC2VPNGateways(sess *session.Session) ([]Resource, error) { - svc := ec2.New(sess) +type EC2VPNGatewayLister struct{} + +func (l *EC2VPNGatewayLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ec2.New(opts.Session) params := &ec2.DescribeVpnGatewaysInput{} resp, err := svc.DescribeVpnGateways(params) @@ -26,7 +37,7 @@ func ListEC2VPNGateways(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.VpnGateways { resources = append(resources, &EC2VPNGateway{ svc: svc, @@ -38,6 +49,12 @@ func ListEC2VPNGateways(sess *session.Session) ([]Resource, error) { return resources, nil } +type EC2VPNGateway struct { + svc *ec2.EC2 + id string + state string +} + func (v *EC2VPNGateway) Filter() error { if v.state == "deleted" { return fmt.Errorf("already deleted") @@ -45,7 +62,7 @@ func (v *EC2VPNGateway) Filter() error { return nil } -func (v *EC2VPNGateway) Remove() error { +func (v *EC2VPNGateway) Remove(_ context.Context) error { params := &ec2.DeleteVpnGatewayInput{ VpnGatewayId: &v.id, } diff --git a/resources/ecr-public-repository.go b/resources/ecr-public-repository.go new file mode 100644 index 000000000..084f406d1 --- /dev/null +++ b/resources/ecr-public-repository.go @@ -0,0 +1,105 @@ +package resources + +import ( + "context" + + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ecrpublic" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +const ECRPublicRepositoryResource = "ECRPublicRepository" + +func init() { + resource.Register(resource.Registration{ + Name: ECRPublicRepositoryResource, + Scope: nuke.Account, + Lister: &ECRPublicRepositoryLister{}, + DependsOn: []string{ + EC2VPNGatewayAttachmentResource, + }, + }, nuke.MapCloudControl("AWS::ECR::PublicRepository")) +} + +type ECRPublicRepositoryLister struct{} + +func (l *ECRPublicRepositoryLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ecrpublic.New(opts.Session) + var resources []resource.Resource + + input := &ecrpublic.DescribeRepositoriesInput{ + MaxResults: aws.Int64(100), + } + + for { + output, err := svc.DescribeRepositories(input) + if err != nil { + return nil, err + } + + for _, repository := range output.Repositories { + tagResp, err := svc.ListTagsForResource(&ecrpublic.ListTagsForResourceInput{ + ResourceArn: repository.RepositoryArn, + }) + if err != nil { + return nil, err + } + resources = append(resources, &ECRPublicRepository{ + svc: svc, + name: repository.RepositoryName, + createdTime: repository.CreatedAt, + tags: tagResp.Tags, + }) + } + + if output.NextToken == nil { + break + } + + input.NextToken = output.NextToken + } + + return resources, nil +} + +type ECRPublicRepository struct { + svc *ecrpublic.ECRPublic + name *string + createdTime *time.Time + tags []*ecrpublic.Tag +} + +func (r *ECRPublicRepository) Filter() error { + return nil +} + +func (r *ECRPublicRepository) Properties() types.Properties { + props := types.NewProperties() + props.Set("CreatedTime", r.createdTime.Format(time.RFC3339)) + + for _, t := range r.tags { + props.SetTag(t.Key, t.Value) + } + + return props +} + +func (r *ECRPublicRepository) Remove(_ context.Context) error { + params := &ecrpublic.DeleteRepositoryInput{ + RepositoryName: r.name, + Force: aws.Bool(true), + } + _, err := r.svc.DeleteRepository(params) + return err +} + +func (r *ECRPublicRepository) String() string { + return *r.name +} diff --git a/resources/ecr-repository.go b/resources/ecr-repository.go index b8bb7be23..5e0a32b1b 100644 --- a/resources/ecr-repository.go +++ b/resources/ecr-repository.go @@ -1,30 +1,37 @@ package resources import ( + "context" + "fmt" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecr" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ECRRepository struct { - svc *ecr.ECR - name *string - createdTime *time.Time - tags []*ecr.Tag -} +const ECRRepositoryResource = "ECRRepository" +const ECRRepositoryCloudControlResource = "AWS::ECR::Repository" func init() { - register("ECRRepository", ListECRRepositories, - mapCloudControl("AWS::ECR::Repository")) + resource.Register(resource.Registration{ + Name: ECRRepositoryResource, + Scope: nuke.Account, + Lister: &ECRRepositoryLister{}, + }, nuke.MapCloudControl(ECRRepositoryCloudControlResource)) } -func ListECRRepositories(sess *session.Session) ([]Resource, error) { - svc := ecr.New(sess) - resources := []Resource{} +type ECRRepositoryLister struct{} + +func (l *ECRRepositoryLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := ecr.New(opts.Session) + var resources []resource.Resource input := &ecr.DescribeRepositoriesInput{ MaxResults: aws.Int64(100), @@ -61,6 +68,13 @@ func ListECRRepositories(sess *session.Session) ([]Resource, error) { return resources, nil } +type ECRRepository struct { + svc *ecr.ECR + name *string + createdTime *time.Time + tags []*ecr.Tag +} + func (r *ECRRepository) Filter() error { return nil } @@ -75,7 +89,7 @@ func (r *ECRRepository) Properties() types.Properties { return properties } -func (r *ECRRepository) Remove() error { +func (r *ECRRepository) Remove(_ context.Context) error { params := &ecr.DeleteRepositoryInput{ RepositoryName: r.name, Force: aws.Bool(true), diff --git a/resources/ecs-clusterinstances.go b/resources/ecs-clusterinstances.go index 37301a10d..3702abf31 100644 --- a/resources/ecs-clusterinstances.go +++ b/resources/ecs-clusterinstances.go @@ -1,27 +1,36 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecs" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ECSClusterInstance struct { - svc *ecs.ECS - instanceARN *string - clusterARN *string -} +const ECSClusterInstanceResource = "ECSClusterInstance" func init() { - register("ECSClusterInstance", ListECSClusterInstances) + resource.Register(resource.Registration{ + Name: ECSClusterInstanceResource, + Scope: nuke.Account, + Lister: &ECSClusterInstanceLister{}, + }) } -func ListECSClusterInstances(sess *session.Session) ([]Resource, error) { - svc := ecs.New(sess) - resources := []Resource{} - clusters := []*string{} +type ECSClusterInstanceLister struct{} + +func (l *ECSClusterInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ecs.New(opts.Session) + resources := make([]resource.Resource, 0) + var clusters []*string clusterParams := &ecs.ListClustersInput{ MaxResults: aws.Int64(100), @@ -75,8 +84,13 @@ func ListECSClusterInstances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ECSClusterInstance) Remove() error { +type ECSClusterInstance struct { + svc *ecs.ECS + instanceARN *string + clusterARN *string +} +func (f *ECSClusterInstance) Remove(_ context.Context) error { _, err := f.svc.DeregisterContainerInstance(&ecs.DeregisterContainerInstanceInput{ Cluster: f.clusterARN, ContainerInstance: f.instanceARN, diff --git a/resources/ecs-clusters.go b/resources/ecs-clusters.go index fe4b229c1..e56f5400f 100644 --- a/resources/ecs-clusters.go +++ b/resources/ecs-clusters.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecs" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ECSCluster struct { - svc *ecs.ECS - ARN *string -} +const ECSClusterResource = "ECSCluster" func init() { - register("ECSCluster", ListECSClusters) + resource.Register(resource.Registration{ + Name: ECSClusterResource, + Scope: nuke.Account, + Lister: &ECSClusterLister{}, + }) } -func ListECSClusters(sess *session.Session) ([]Resource, error) { - svc := ecs.New(sess) - resources := []Resource{} +type ECSClusterLister struct{} + +func (l *ECSClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ecs.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ecs.ListClustersInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListECSClusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ECSCluster) Remove() error { +type ECSCluster struct { + svc *ecs.ECS + ARN *string +} +func (f *ECSCluster) Remove(_ context.Context) error { _, err := f.svc.DeleteCluster(&ecs.DeleteClusterInput{ Cluster: f.ARN, }) diff --git a/resources/ecs-services.go b/resources/ecs-services.go index d5a3792e6..c157e66a6 100644 --- a/resources/ecs-services.go +++ b/resources/ecs-services.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecs" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ECSService struct { - svc *ecs.ECS - serviceARN *string - clusterARN *string -} +const ECSServiceResource = "ECSService" func init() { - register("ECSService", ListECSServices) + resource.Register(resource.Registration{ + Name: ECSServiceResource, + Scope: nuke.Account, + Lister: &ECSServiceLister{}, + }) } -func ListECSServices(sess *session.Session) ([]Resource, error) { - svc := ecs.New(sess) - resources := []Resource{} +type ECSServiceLister struct{} + +func (l *ECSServiceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ecs.New(opts.Session) + resources := make([]resource.Resource, 0) clusters := []*string{} clusterParams := &ecs.ListClustersInput{ @@ -75,8 +84,13 @@ func ListECSServices(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ECSService) Remove() error { +type ECSService struct { + svc *ecs.ECS + serviceARN *string + clusterARN *string +} +func (f *ECSService) Remove(_ context.Context) error { _, err := f.svc.DeleteService(&ecs.DeleteServiceInput{ Cluster: f.clusterARN, Service: f.serviceARN, diff --git a/resources/ecs-taskdefinitions.go b/resources/ecs-taskdefinitions.go index 0ced17c85..af7ede37b 100644 --- a/resources/ecs-taskdefinitions.go +++ b/resources/ecs-taskdefinitions.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecs" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ECSTaskDefinition struct { - svc *ecs.ECS - ARN *string -} +const ECSTaskDefinitionResource = "ECSTaskDefinition" func init() { - register("ECSTaskDefinition", ListECSTaskDefinitions) + resource.Register(resource.Registration{ + Name: ECSTaskDefinitionResource, + Scope: nuke.Account, + Lister: &ECSTaskDefinitionLister{}, + }) } -func ListECSTaskDefinitions(sess *session.Session) ([]Resource, error) { - svc := ecs.New(sess) - resources := []Resource{} +type ECSTaskDefinitionLister struct{} + +func (l *ECSTaskDefinitionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ecs.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ecs.ListTaskDefinitionsInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListECSTaskDefinitions(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ECSTaskDefinition) Remove() error { +type ECSTaskDefinition struct { + svc *ecs.ECS + ARN *string +} +func (f *ECSTaskDefinition) Remove(_ context.Context) error { _, err := f.svc.DeregisterTaskDefinition(&ecs.DeregisterTaskDefinitionInput{ TaskDefinition: f.ARN, }) diff --git a/resources/ecs-tasks.go b/resources/ecs-tasks.go index c492bd2df..8b14c8c31 100644 --- a/resources/ecs-tasks.go +++ b/resources/ecs-tasks.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecs" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ECSTask struct { - svc *ecs.ECS - taskARN *string - clusterARN *string -} +const ECSTaskResource = "ECSTask" func init() { - register("ECSTask", ListECSTasks) + resource.Register(resource.Registration{ + Name: ECSTaskResource, + Scope: nuke.Account, + Lister: &ECSTaskLister{}, + }) } -func ListECSTasks(sess *session.Session) ([]Resource, error) { - svc := ecs.New(sess) - resources := []Resource{} - clusters := []*string{} +type ECSTaskLister struct{} + +func (l *ECSTaskLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ecs.New(opts.Session) + resources := make([]resource.Resource, 0) + var clusters []*string clusterParams := &ecs.ListClustersInput{ MaxResults: aws.Int64(100), @@ -72,6 +81,12 @@ func ListECSTasks(sess *session.Session) ([]Resource, error) { return resources, nil } +type ECSTask struct { + svc *ecs.ECS + taskARN *string + clusterARN *string +} + func (t *ECSTask) Filter() error { return nil } @@ -84,13 +99,12 @@ func (t *ECSTask) Properties() types.Properties { return properties } -func (t *ECSTask) Remove() error { +func (t *ECSTask) Remove(_ context.Context) error { // When StopTask is called on a task, the equivalent of docker stop is issued to the // containers running in the task. This results in a SIGTERM value and a default // 30-second timeout, after which the SIGKILL value is sent and the containers are // forcibly stopped. If the container handles the SIGTERM value gracefully and exits // within 30 seconds from receiving it, no SIGKILL value is sent. - _, err := t.svc.StopTask(&ecs.StopTaskInput{ Cluster: t.clusterARN, Task: t.taskARN, diff --git a/resources/efs-filesystem.go b/resources/efs-filesystem.go index 9430b39de..e50d27dd9 100644 --- a/resources/efs-filesystem.go +++ b/resources/efs-filesystem.go @@ -1,31 +1,39 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/efs" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EFSFileSystem struct { - svc *efs.EFS - id string - name string - tagList []*efs.Tag -} +const EFSFileSystemResource = "EFSFileSystem" func init() { - register("EFSFileSystem", ListEFSFileSystems) + resource.Register(resource.Registration{ + Name: EFSFileSystemResource, + Scope: nuke.Account, + Lister: &EFSFileSystemLister{}, + }) } -func ListEFSFileSystems(sess *session.Session) ([]Resource, error) { - svc := efs.New(sess) +type EFSFileSystemLister struct{} + +func (l *EFSFileSystemLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := efs.New(opts.Session) resp, err := svc.DescribeFileSystems(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, fs := range resp.FileSystems { lto, err := svc.ListTagsForResource(&efs.ListTagsForResourceInput{ResourceId: fs.FileSystemId}) if err != nil { @@ -43,7 +51,14 @@ func ListEFSFileSystems(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EFSFileSystem) Remove() error { +type EFSFileSystem struct { + svc *efs.EFS + id string + name string + tagList []*efs.Tag +} + +func (e *EFSFileSystem) Remove(_ context.Context) error { _, err := e.svc.DeleteFileSystem(&efs.DeleteFileSystemInput{ FileSystemId: &e.id, }) diff --git a/resources/efs-mount-targets.go b/resources/efs-mount-targets.go index 13d5e7d39..67c76bab0 100644 --- a/resources/efs-mount-targets.go +++ b/resources/efs-mount-targets.go @@ -1,33 +1,41 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/efs" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EFSMountTarget struct { - svc *efs.EFS - id string - fsid string - fsTags []*efs.Tag -} +const EFSMountTargetResource = "EFSMountTarget" func init() { - register("EFSMountTarget", ListEFSMountTargets) + resource.Register(resource.Registration{ + Name: EFSMountTargetResource, + Scope: nuke.Account, + Lister: &EFSMountTargetLister{}, + }) } -func ListEFSMountTargets(sess *session.Session) ([]Resource, error) { - svc := efs.New(sess) +type EFSMountTargetLister struct{} + +func (l *EFSMountTargetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := efs.New(opts.Session) resp, err := svc.DescribeFileSystems(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, fs := range resp.FileSystems { mt, err := svc.DescribeMountTargets(&efs.DescribeMountTargetsInput{ FileSystemId: fs.FileSystemId, @@ -45,7 +53,7 @@ func ListEFSMountTargets(sess *session.Session) ([]Resource, error) { resources = append(resources, &EFSMountTarget{ svc: svc, id: *t.MountTargetId, - fsid: *t.FileSystemId, + fsID: *t.FileSystemId, fsTags: lto.Tags, }) @@ -55,7 +63,14 @@ func ListEFSMountTargets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *EFSMountTarget) Remove() error { +type EFSMountTarget struct { + svc *efs.EFS + id string + fsID string + fsTags []*efs.Tag +} + +func (e *EFSMountTarget) Remove(_ context.Context) error { _, err := e.svc.DeleteMountTarget(&efs.DeleteMountTargetInput{ MountTargetId: &e.id, }) @@ -69,10 +84,10 @@ func (e *EFSMountTarget) Properties() types.Properties { properties.SetTagWithPrefix("efs", tagValue.Key, tagValue.Value) } properties.Set("Name", e.id) - properties.Set("ID", e.fsid) + properties.Set("ID", e.fsID) return properties } func (e *EFSMountTarget) String() string { - return fmt.Sprintf("%s:%s", e.fsid, e.id) + return fmt.Sprintf("%s:%s", e.fsID, e.id) } diff --git a/resources/eks-clusters.go b/resources/eks-clusters.go index 999d33a04..a1c25fb9f 100644 --- a/resources/eks-clusters.go +++ b/resources/eks-clusters.go @@ -1,27 +1,35 @@ package resources import ( + "context" + "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/eks" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EKSCluster struct { - svc *eks.EKS - name *string - cluster *eks.Cluster -} +const EKSClusterResource = "EKSCluster" func init() { - register("EKSCluster", ListEKSClusters) + resource.Register(resource.Registration{ + Name: EKSClusterResource, + Scope: nuke.Account, + Lister: &EKSClusterLister{}, + }) } -func ListEKSClusters(sess *session.Session) ([]Resource, error) { - svc := eks.New(sess) - resources := []Resource{} +type EKSClusterLister struct{} + +func (l *EKSClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := eks.New(opts.Session) + var resources []resource.Resource params := &eks.ListClustersInput{ MaxResults: aws.Int64(100), @@ -53,7 +61,13 @@ func ListEKSClusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *EKSCluster) Remove() error { +type EKSCluster struct { + svc *eks.EKS + name *string + cluster *eks.Cluster +} + +func (f *EKSCluster) Remove(_ context.Context) error { _, err := f.svc.DeleteCluster(&eks.DeleteClusterInput{ Name: f.name, diff --git a/resources/eks-fargate.go b/resources/eks-fargate.go index feb2a7258..e8eb6106e 100644 --- a/resources/eks-fargate.go +++ b/resources/eks-fargate.go @@ -1,28 +1,36 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/eks" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EKSFargateProfile struct { - svc *eks.EKS - cluster *string - name *string -} +const EKSFargateProfileResource = "EKSFargateProfile" func init() { - register("EKSFargateProfiles", ListEKSFargateProfiles) + resource.Register(resource.Registration{ + Name: EKSFargateProfileResource, + Scope: nuke.Account, + Lister: &EKSFargateProfileLister{}, + }) } -func ListEKSFargateProfiles(sess *session.Session) ([]Resource, error) { - svc := eks.New(sess) - clusterNames := []*string{} - resources := []Resource{} +type EKSFargateProfileLister struct{} + +func (l *EKSFargateProfileLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := eks.New(opts.Session) + var clusterNames []*string + var resources []resource.Resource clusterInputParams := &eks.ListClustersInput{ MaxResults: aws.Int64(100), @@ -81,7 +89,13 @@ func ListEKSFargateProfiles(sess *session.Session) ([]Resource, error) { return resources, nil } -func (fp *EKSFargateProfile) Remove() error { +type EKSFargateProfile struct { + svc *eks.EKS + cluster *string + name *string +} + +func (fp *EKSFargateProfile) Remove(_ context.Context) error { _, err := fp.svc.DeleteFargateProfile(&eks.DeleteFargateProfileInput{ ClusterName: fp.cluster, FargateProfileName: fp.name, diff --git a/resources/eks-nodegroups.go b/resources/eks-nodegroups.go index 8cf8d6ffa..6ad79f5b5 100644 --- a/resources/eks-nodegroups.go +++ b/resources/eks-nodegroups.go @@ -1,28 +1,38 @@ package resources import ( + "context" + "fmt" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/eks" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EKSNodegroup struct { - svc *eks.EKS - nodegroup *eks.Nodegroup -} +const EKSNodegroupResource = "EKSNodegroup" func init() { - register("EKSNodegroups", ListEKSNodegroups) + resource.Register(resource.Registration{ + Name: EKSNodegroupResource, + Scope: nuke.Account, + Lister: &EKSNodegroupLister{}, + }) } -func ListEKSNodegroups(sess *session.Session) ([]Resource, error) { - svc := eks.New(sess) - clusterNames := []*string{} - resources := []Resource{} +type EKSNodegroupLister struct{} + +func (l *EKSNodegroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := eks.New(opts.Session) + + var clusterNames []*string + var resources []resource.Resource clusterInputParams := &eks.ListClustersInput{ MaxResults: aws.Int64(100), @@ -86,7 +96,12 @@ func ListEKSNodegroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (ng *EKSNodegroup) Remove() error { +type EKSNodegroup struct { + svc *eks.EKS + nodegroup *eks.Nodegroup +} + +func (ng *EKSNodegroup) Remove(_ context.Context) error { _, err := ng.svc.DeleteNodegroup(&eks.DeleteNodegroupInput{ ClusterName: ng.nodegroup.ClusterName, NodegroupName: ng.nodegroup.NodegroupName, diff --git a/resources/elasticache-cacheparametergroups.go b/resources/elasticache-cacheparametergroups.go index c6d3e00cc..aa9981a90 100644 --- a/resources/elasticache-cacheparametergroups.go +++ b/resources/elasticache-cacheparametergroups.go @@ -1,28 +1,37 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elasticache" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ElasticacheCacheParameterGroup struct { - svc *elasticache.ElastiCache - groupName *string - groupFamily *string -} +const ElasticacheCacheParameterGroupResource = "ElasticacheCacheParameterGroup" func init() { - register("ElasticacheCacheParameterGroup", ListElasticacheCacheParameterGroups) + resource.Register(resource.Registration{ + Name: ElasticacheCacheParameterGroupResource, + Scope: nuke.Account, + Lister: &ElasticacheCacheParameterGroupLister{}, + }) } -func ListElasticacheCacheParameterGroups(sess *session.Session) ([]Resource, error) { - svc := elasticache.New(sess) - var resources []Resource +type ElasticacheCacheParameterGroupLister struct{} + +func (l *ElasticacheCacheParameterGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elasticache.New(opts.Session) + var resources []resource.Resource params := &elasticache.DescribeCacheParameterGroupsInput{MaxRecords: aws.Int64(100)} @@ -50,14 +59,20 @@ func ListElasticacheCacheParameterGroups(sess *session.Session) ([]Resource, err return resources, nil } +type ElasticacheCacheParameterGroup struct { + svc *elasticache.ElastiCache + groupName *string + groupFamily *string +} + func (i *ElasticacheCacheParameterGroup) Filter() error { if strings.HasPrefix(*i.groupName, "default.") { - return fmt.Errorf("Cannot delete default cache parameter group") + return fmt.Errorf("cannot delete default cache parameter group") } return nil } -func (i *ElasticacheCacheParameterGroup) Remove() error { +func (i *ElasticacheCacheParameterGroup) Remove(_ context.Context) error { params := &elasticache.DeleteCacheParameterGroupInput{ CacheParameterGroupName: i.groupName, } diff --git a/resources/elasticache-memcachecluster.go b/resources/elasticache-memcacheclusters.go similarity index 53% rename from resources/elasticache-memcachecluster.go rename to resources/elasticache-memcacheclusters.go index c251b12ba..676a1cd02 100644 --- a/resources/elasticache-memcachecluster.go +++ b/resources/elasticache-memcacheclusters.go @@ -1,30 +1,45 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elasticache" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ElasticacheCacheCluster struct { - svc *elasticache.ElastiCache - clusterID *string - status *string -} +const ElasticacheCacheClusterResource = "ElasticacheCacheCluster" func init() { - register("ElasticacheCacheCluster", ListElasticacheCacheClusters) + resource.Register(resource.Registration{ + Name: ElasticacheCacheClusterResource, + Scope: nuke.Account, + Lister: &ElasticacheCacheClusterLister{}, + DependsOn: []string{ + ElasticacheCacheParameterGroupResource, + ElasticacheReplicationGroupResource, + ElasticacheSubnetGroupResource, + }, + }) } -func ListElasticacheCacheClusters(sess *session.Session) ([]Resource, error) { - svc := elasticache.New(sess) +type ElasticacheCacheClusterLister struct{} + +func (l *ElasticacheCacheClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elasticache.New(opts.Session) params := &elasticache.DescribeCacheClustersInput{MaxRecords: aws.Int64(100)} resp, err := svc.DescribeCacheClusters(params) if err != nil { return nil, err } - var resources []Resource + + var resources []resource.Resource for _, cacheCluster := range resp.CacheClusters { resources = append(resources, &ElasticacheCacheCluster{ svc: svc, @@ -36,7 +51,13 @@ func ListElasticacheCacheClusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *ElasticacheCacheCluster) Remove() error { +type ElasticacheCacheCluster struct { + svc *elasticache.ElastiCache + clusterID *string + status *string +} + +func (i *ElasticacheCacheCluster) Remove(_ context.Context) error { params := &elasticache.DeleteCacheClusterInput{ CacheClusterId: i.clusterID, } diff --git a/resources/elasticache-replicationgroups.go b/resources/elasticache-replicationgroups.go index b677263e4..9f3b07cfe 100644 --- a/resources/elasticache-replicationgroups.go +++ b/resources/elasticache-replicationgroups.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elasticache" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ElasticacheReplicationGroup struct { - svc *elasticache.ElastiCache - groupID *string -} +const ElasticacheReplicationGroupResource = "ElasticacheReplicationGroup" func init() { - register("ElasticacheReplicationGroup", ListElasticacheReplicationGroups) + resource.Register(resource.Registration{ + Name: ElasticacheReplicationGroupResource, + Scope: nuke.Account, + Lister: &ElasticacheReplicationGroupLister{}, + }) } -func ListElasticacheReplicationGroups(sess *session.Session) ([]Resource, error) { - svc := elasticache.New(sess) - var resources []Resource +type ElasticacheReplicationGroupLister struct{} + +func (l *ElasticacheReplicationGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elasticache.New(opts.Session) + var resources []resource.Resource params := &elasticache.DescribeReplicationGroupsInput{MaxRecords: aws.Int64(100)} @@ -44,7 +54,12 @@ func ListElasticacheReplicationGroups(sess *session.Session) ([]Resource, error) return resources, nil } -func (i *ElasticacheReplicationGroup) Remove() error { +type ElasticacheReplicationGroup struct { + svc *elasticache.ElastiCache + groupID *string +} + +func (i *ElasticacheReplicationGroup) Remove(_ context.Context) error { params := &elasticache.DeleteReplicationGroupInput{ ReplicationGroupId: i.groupID, } diff --git a/resources/elasticache-subnetgroups.go b/resources/elasticache-subnetgroups.go index 2e17689e1..d8be4a096 100644 --- a/resources/elasticache-subnetgroups.go +++ b/resources/elasticache-subnetgroups.go @@ -1,29 +1,39 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elasticache" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ElasticacheSubnetGroup struct { - svc *elasticache.ElastiCache - name *string -} +const ElasticacheSubnetGroupResource = "ElasticacheSubnetGroup" func init() { - register("ElasticacheSubnetGroup", ListElasticacheSubnetGroups) + resource.Register(resource.Registration{ + Name: ElasticacheSubnetGroupResource, + Scope: nuke.Account, + Lister: &ElasticacheSubnetGroupLister{}, + }) } -func ListElasticacheSubnetGroups(sess *session.Session) ([]Resource, error) { - svc := elasticache.New(sess) +type ElasticacheSubnetGroupLister struct{} + +func (l *ElasticacheSubnetGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elasticache.New(opts.Session) params := &elasticache.DescribeCacheSubnetGroupsInput{MaxRecords: aws.Int64(100)} resp, err := svc.DescribeCacheSubnetGroups(params) if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource for _, subnetGroup := range resp.CacheSubnetGroups { resources = append(resources, &ElasticacheSubnetGroup{ svc: svc, @@ -35,7 +45,12 @@ func ListElasticacheSubnetGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *ElasticacheSubnetGroup) Remove() error { +type ElasticacheSubnetGroup struct { + svc *elasticache.ElastiCache + name *string +} + +func (i *ElasticacheSubnetGroup) Remove(_ context.Context) error { params := &elasticache.DeleteCacheSubnetGroupInput{ CacheSubnetGroupName: i.name, } diff --git a/resources/elasticbeanstalk-applications.go b/resources/elasticbeanstalk-applications.go index 1da129f5f..eafb53fdd 100644 --- a/resources/elasticbeanstalk-applications.go +++ b/resources/elasticbeanstalk-applications.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/elasticbeanstalk" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ElasticBeanstalkApplication struct { - svc *elasticbeanstalk.ElasticBeanstalk - name *string -} +const ElasticBeanstalkApplicationResource = "ElasticBeanstalkApplication" func init() { - register("ElasticBeanstalkApplication", ListElasticBeanstalkApplications) + resource.Register(resource.Registration{ + Name: ElasticBeanstalkApplicationResource, + Scope: nuke.Account, + Lister: &ElasticBeanstalkApplicationLister{}, + }) } -func ListElasticBeanstalkApplications(sess *session.Session) ([]Resource, error) { - svc := elasticbeanstalk.New(sess) - resources := []Resource{} +type ElasticBeanstalkApplicationLister struct{} + +func (l *ElasticBeanstalkApplicationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elasticbeanstalk.New(opts.Session) + resources := make([]resource.Resource, 0) params := &elasticbeanstalk.DescribeApplicationsInput{} @@ -35,8 +45,12 @@ func ListElasticBeanstalkApplications(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *ElasticBeanstalkApplication) Remove() error { +type ElasticBeanstalkApplication struct { + svc *elasticbeanstalk.ElasticBeanstalk + name *string +} +func (f *ElasticBeanstalkApplication) Remove(_ context.Context) error { _, err := f.svc.DeleteApplication(&elasticbeanstalk.DeleteApplicationInput{ ApplicationName: f.name, }) diff --git a/resources/elasticbeanstalk-environments.go b/resources/elasticbeanstalk-environments.go index b65a50c26..247657db7 100644 --- a/resources/elasticbeanstalk-environments.go +++ b/resources/elasticbeanstalk-environments.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elasticbeanstalk" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ElasticBeanstalkEnvironment struct { - svc *elasticbeanstalk.ElasticBeanstalk - ID *string - name *string -} +const ElasticBeanstalkEnvironmentResource = "ElasticBeanstalkEnvironment" func init() { - register("ElasticBeanstalkEnvironment", ListElasticBeanstalkEnvironments) + resource.Register(resource.Registration{ + Name: ElasticBeanstalkEnvironmentResource, + Scope: nuke.Account, + Lister: &ElasticBeanstalkEnvironmentLister{}, + }) } -func ListElasticBeanstalkEnvironments(sess *session.Session) ([]Resource, error) { - svc := elasticbeanstalk.New(sess) - resources := []Resource{} +type ElasticBeanstalkEnvironmentLister struct{} + +func (l *ElasticBeanstalkEnvironmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elasticbeanstalk.New(opts.Session) + resources := make([]resource.Resource, 0) params := &elasticbeanstalk.DescribeEnvironmentsInput{ MaxRecords: aws.Int64(100), @@ -50,8 +59,13 @@ func ListElasticBeanstalkEnvironments(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *ElasticBeanstalkEnvironment) Remove() error { +type ElasticBeanstalkEnvironment struct { + svc *elasticbeanstalk.ElasticBeanstalk + ID *string + name *string +} +func (f *ElasticBeanstalkEnvironment) Remove(_ context.Context) error { _, err := f.svc.TerminateEnvironment(&elasticbeanstalk.TerminateEnvironmentInput{ EnvironmentId: f.ID, ForceTerminate: aws.Bool(true), diff --git a/resources/elasticsearchservice-domain.go b/resources/elasticsearchservice-domain.go index f6e461cad..88a35ca84 100644 --- a/resources/elasticsearchservice-domain.go +++ b/resources/elasticsearchservice-domain.go @@ -1,23 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/elasticsearchservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ESDomain struct { - svc *elasticsearchservice.ElasticsearchService - domainName *string - tagList []*elasticsearchservice.Tag -} +const ESDomainResource = "ESDomain" func init() { - register("ESDomain", ListESDomains) + resource.Register(resource.Registration{ + Name: ESDomainResource, + Scope: nuke.Account, + Lister: &ESDomainLister{}, + }) } -func ListESDomains(sess *session.Session) ([]Resource, error) { - svc := elasticsearchservice.New(sess) +type ESDomainLister struct{} + +func (l *ESDomainLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elasticsearchservice.New(opts.Session) params := &elasticsearchservice.ListDomainNamesInput{} resp, err := svc.ListDomainNames(params) @@ -25,7 +34,7 @@ func ListESDomains(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, domain := range resp.DomainNames { dedo, err := svc.DescribeElasticsearchDomain( &elasticsearchservice.DescribeElasticsearchDomainInput{DomainName: domain.DomainName}) @@ -46,8 +55,13 @@ func ListESDomains(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ESDomain) Remove() error { +type ESDomain struct { + svc *elasticsearchservice.ElasticsearchService + domainName *string + tagList []*elasticsearchservice.Tag +} +func (f *ESDomain) Remove(_ context.Context) error { _, err := f.svc.DeleteElasticsearchDomain(&elasticsearchservice.DeleteElasticsearchDomainInput{ DomainName: f.domainName, }) diff --git a/resources/elastictranscoder-pipelines.go b/resources/elastictranscoder-pipelines.go index 28264a058..bdcb7b2ee 100644 --- a/resources/elastictranscoder-pipelines.go +++ b/resources/elastictranscoder-pipelines.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/elastictranscoder" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ElasticTranscoderPipeline struct { - svc *elastictranscoder.ElasticTranscoder - pipelineID *string -} +const ElasticTranscoderPipelineResource = "ElasticTranscoderPipeline" func init() { - register("ElasticTranscoderPipeline", ListElasticTranscoderPipelines) + resource.Register(resource.Registration{ + Name: ElasticTranscoderPipelineResource, + Scope: nuke.Account, + Lister: &ElasticTranscoderPipelineLister{}, + }) } -func ListElasticTranscoderPipelines(sess *session.Session) ([]Resource, error) { - svc := elastictranscoder.New(sess) - resources := []Resource{} +type ElasticTranscoderPipelineLister struct{} + +func (l *ElasticTranscoderPipelineLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elastictranscoder.New(opts.Session) + resources := make([]resource.Resource, 0) params := &elastictranscoder.ListPipelinesInput{} @@ -43,8 +53,12 @@ func ListElasticTranscoderPipelines(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ElasticTranscoderPipeline) Remove() error { +type ElasticTranscoderPipeline struct { + svc *elastictranscoder.ElasticTranscoder + pipelineID *string +} +func (f *ElasticTranscoderPipeline) Remove(_ context.Context) error { _, err := f.svc.DeletePipeline(&elastictranscoder.DeletePipelineInput{ Id: f.pipelineID, }) diff --git a/resources/elb-elb.go b/resources/elb-elb.go index fd37b0cf2..d8dd12df2 100644 --- a/resources/elb-elb.go +++ b/resources/elb-elb.go @@ -1,28 +1,37 @@ package resources import ( + "context" + "time" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elb" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ELBLoadBalancer struct { - svc *elb.ELB - elb *elb.LoadBalancerDescription - tags []*elb.Tag -} +const ELBResource = "ELB" func init() { - register("ELB", ListELBLoadBalancers) + resource.Register(resource.Registration{ + Name: ELBResource, + Scope: nuke.Account, + Lister: &ELBLister{}, + }) } -func ListELBLoadBalancers(sess *session.Session) ([]Resource, error) { - resources := make([]Resource, 0) +type ELBLister struct{} + +func (l *ELBLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + resources := make([]resource.Resource, 0) elbNames := make([]*string, 0) elbNameToRsc := make(map[string]*elb.LoadBalancerDescription) - svc := elb.New(sess) + svc := elb.New(opts.Session) err := svc.DescribeLoadBalancersPages(nil, func(page *elb.DescribeLoadBalancersOutput, lastPage bool) bool { @@ -50,10 +59,10 @@ func ListELBLoadBalancers(sess *session.Session) ([]Resource, error) { return nil, err } for _, elbTagInfo := range tagResp.TagDescriptions { - elb := elbNameToRsc[*elbTagInfo.LoadBalancerName] + elbEntity := elbNameToRsc[*elbTagInfo.LoadBalancerName] resources = append(resources, &ELBLoadBalancer{ svc: svc, - elb: elb, + elb: elbEntity, tags: elbTagInfo.Tags, }) } @@ -65,7 +74,13 @@ func ListELBLoadBalancers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *ELBLoadBalancer) Remove() error { +type ELBLoadBalancer struct { + svc *elb.ELB + elb *elb.LoadBalancerDescription + tags []*elb.Tag +} + +func (e *ELBLoadBalancer) Remove(_ context.Context) error { params := &elb.DeleteLoadBalancerInput{ LoadBalancerName: e.elb.LoadBalancerName, } diff --git a/resources/elbv2-alb.go b/resources/elbv2-alb.go index 9e5717113..344c54cdd 100644 --- a/resources/elbv2-alb.go +++ b/resources/elbv2-alb.go @@ -1,29 +1,45 @@ package resources import ( + "context" + + "errors" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elbv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/featureflag" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type ELBv2LoadBalancer struct { svc *elbv2.ELBV2 tags []*elbv2.Tag elb *elbv2.LoadBalancer - featureFlags config.FeatureFlags + featureFlags *featureflag.FeatureFlags } +const ELBv2Resource = "ELBv2" + func init() { - register("ELBv2", ListELBv2LoadBalancers) + resource.Register(resource.Registration{ + Name: ELBv2Resource, + Scope: nuke.Account, + Lister: &ELBv2Lister{}, + }) } -func ListELBv2LoadBalancers(sess *session.Session) ([]Resource, error) { - svc := elbv2.New(sess) +type ELBv2Lister struct{} + +func (l *ELBv2Lister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elbv2.New(opts.Session) var tagReqELBv2ARNs []*string elbv2ARNToRsc := make(map[string]*elbv2.LoadBalancer) @@ -43,7 +59,7 @@ func ListELBv2LoadBalancers(sess *session.Session) ([]Resource, error) { // Tags for ELBv2s need to be fetched separately // We can only specify up to 20 in a single call // See: https://github.com/aws/aws-sdk-go/blob/0e8c61841163762f870f6976775800ded4a789b0/service/elbv2/api.go#L5398 - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for len(tagReqELBv2ARNs) > 0 { requestElements := len(tagReqELBv2ARNs) if requestElements > 20 { @@ -71,34 +87,43 @@ func ListELBv2LoadBalancers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *ELBv2LoadBalancer) FeatureFlags(ff config.FeatureFlags) { +func (e *ELBv2LoadBalancer) FeatureFlags(ff *featureflag.FeatureFlags) { e.featureFlags = ff } -func (e *ELBv2LoadBalancer) Remove() error { +func (e *ELBv2LoadBalancer) Remove(_ context.Context) error { + ffdddElbV2, err := e.featureFlags.Get("DisableDeletionProtection_ELBv2") + if err != nil { + return err + } + params := &elbv2.DeleteLoadBalancerInput{ LoadBalancerArn: e.elb.LoadBalancerArn, } - _, err := e.svc.DeleteLoadBalancer(params) - if err != nil { - if e.featureFlags.DisableDeletionProtection.ELBv2 { - awsErr, ok := err.(awserr.Error) + if _, err := e.svc.DeleteLoadBalancer(params); err != nil { + if ffdddElbV2.Enabled() { + var awsErr awserr.Error + ok := errors.As(err, &awsErr) if ok && awsErr.Code() == "OperationNotPermitted" && awsErr.Message() == "Load balancer '"+*e.elb.LoadBalancerArn+"' cannot be deleted because deletion protection is enabled" { err = e.DisableProtection() if err != nil { return err } + _, err := e.svc.DeleteLoadBalancer(params) if err != nil { return err } + return nil } } + return err } + return nil } @@ -112,10 +137,12 @@ func (e *ELBv2LoadBalancer) DisableProtection() error { }, }, } + _, err := e.svc.ModifyLoadBalancerAttributes(params) if err != nil { return err } + return nil } @@ -123,6 +150,7 @@ func (e *ELBv2LoadBalancer) Properties() types.Properties { properties := types.NewProperties(). Set("CreatedTime", e.elb.CreatedTime.Format(time.RFC3339)). Set("ARN", e.elb.LoadBalancerArn) + for _, tagValue := range e.tags { properties.SetTag(tagValue.Key, tagValue.Value) } diff --git a/resources/elbv2-targetgroup.go b/resources/elbv2-targetgroup.go index 7699567ec..ee7a4c633 100644 --- a/resources/elbv2-targetgroup.go +++ b/resources/elbv2-targetgroup.go @@ -1,23 +1,35 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/elbv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ELBv2TargetGroup struct { - svc *elbv2.ELBV2 - tg *elbv2.TargetGroup - tags []*elbv2.Tag -} +const ELBv2TargetGroupResource = "ELBv2TargetGroup" func init() { - register("ELBv2TargetGroup", ListELBv2TargetGroups) + resource.Register(resource.Registration{ + Name: ELBv2TargetGroupResource, + Scope: nuke.Account, + Lister: &ELBv2TargetGroupLister{}, + DependsOn: []string{ + ELBv2Resource, + }, + }) } -func ListELBv2TargetGroups(sess *session.Session) ([]Resource, error) { - svc := elbv2.New(sess) +type ELBv2TargetGroupLister struct{} + +func (l *ELBv2TargetGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := elbv2.New(opts.Session) var tagReqELBv2TargetGroupARNs []*string targetGroupARNToRsc := make(map[string]*elbv2.TargetGroup) @@ -36,7 +48,7 @@ func ListELBv2TargetGroups(sess *session.Session) ([]Resource, error) { // Tags for ELBv2 target groups need to be fetched separately // We can only specify up to 20 in a single call // See: https://github.com/aws/aws-sdk-go/blob/0e8c61841163762f870f6976775800ded4a789b0/service/elbv2/api.go#L5398 - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for len(tagReqELBv2TargetGroupARNs) > 0 { requestElements := len(tagReqELBv2TargetGroupARNs) if requestElements > 20 { @@ -63,7 +75,13 @@ func ListELBv2TargetGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *ELBv2TargetGroup) Remove() error { +type ELBv2TargetGroup struct { + svc *elbv2.ELBV2 + tg *elbv2.TargetGroup + tags []*elbv2.Tag +} + +func (e *ELBv2TargetGroup) Remove(_ context.Context) error { _, err := e.svc.DeleteTargetGroup(&elbv2.DeleteTargetGroupInput{ TargetGroupArn: e.tg.TargetGroupArn, }) @@ -78,10 +96,13 @@ func (e *ELBv2TargetGroup) Remove() error { func (e *ELBv2TargetGroup) Properties() types.Properties { properties := types.NewProperties(). Set("ARN", e.tg.TargetGroupArn) + for _, tagValue := range e.tags { properties.SetTag(tagValue.Key, tagValue.Value) } + properties.Set("IsLoadBalanced", len(e.tg.LoadBalancerArns) > 0) + return properties } diff --git a/resources/emr-clusters.go b/resources/emr-clusters.go index 7c3da8c1e..187373f48 100644 --- a/resources/emr-clusters.go +++ b/resources/emr-clusters.go @@ -1,28 +1,37 @@ package resources import ( + "context" + "fmt" "strings" "time" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/emr" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EMRCluster struct { - svc *emr.EMR - cluster *emr.ClusterSummary - state *string -} +const EMRClusterResource = "EMRCluster" func init() { - register("EMRCluster", ListEMRClusters) + resource.Register(resource.Registration{ + Name: EMRClusterResource, + Scope: nuke.Account, + Lister: &EMRClusterLister{}, + }) } -func ListEMRClusters(sess *session.Session) ([]Resource, error) { - svc := emr.New(sess) - resources := []Resource{} +type EMRClusterLister struct{} + +func (l *EMRClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := emr.New(opts.Session) + resources := make([]resource.Resource, 0) params := &emr.ListClustersInput{} @@ -50,18 +59,25 @@ func ListEMRClusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *EMRCluster) Properties() types.Properties { - properties := types.NewProperties(). - Set("CreatedTime", f.cluster.Status.Timeline.CreationDateTime.Format(time.RFC3339)) - return properties +type EMRCluster struct { + svc *emr.EMR + cluster *emr.ClusterSummary + state *string } -func (f *EMRCluster) Remove() error { +func (f *EMRCluster) Filter() error { + if strings.Contains(*f.state, "TERMINATED") { + return fmt.Errorf("already terminated") + } + return nil +} - //Call names are inconsistent in the SDK +func (f *EMRCluster) Remove(_ context.Context) error { + // Note: Call names are inconsistent in the SDK _, err := f.svc.TerminateJobFlows(&emr.TerminateJobFlowsInput{ JobFlowIds: []*string{f.cluster.Id}, }) + // Force nil return due to async callbacks blocking if err == nil { return nil @@ -70,13 +86,13 @@ func (f *EMRCluster) Remove() error { return err } -func (f *EMRCluster) String() string { - return *f.cluster.Id +func (f *EMRCluster) Properties() types.Properties { + properties := types.NewProperties(). + Set("CreatedTime", f.cluster.Status.Timeline.CreationDateTime.Format(time.RFC3339)) + + return properties } -func (f *EMRCluster) Filter() error { - if strings.Contains(*f.state, "TERMINATED") { - return fmt.Errorf("already terminated") - } - return nil +func (f *EMRCluster) String() string { + return *f.cluster.Id } diff --git a/resources/emr-securityconfigurations.go b/resources/emr-securityconfigurations.go index d622f00f2..711e495bf 100644 --- a/resources/emr-securityconfigurations.go +++ b/resources/emr-securityconfigurations.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/emr" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type EMRSecurityConfiguration struct { - svc *emr.EMR - name *string -} +const EMRSecurityConfigurationResource = "EMRSecurityConfiguration" func init() { - register("EMRSecurityConfiguration", ListEMRSecurityConfiguration) + resource.Register(resource.Registration{ + Name: EMRSecurityConfigurationResource, + Scope: nuke.Account, + Lister: &EMRSecurityConfigurationLister{}, + }) } -func ListEMRSecurityConfiguration(sess *session.Session) ([]Resource, error) { - svc := emr.New(sess) - resources := []Resource{} +type EMRSecurityConfigurationLister struct{} + +func (l *EMRSecurityConfigurationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := emr.New(opts.Session) + resources := make([]resource.Resource, 0) params := &emr.ListSecurityConfigurationsInput{} @@ -43,9 +53,13 @@ func ListEMRSecurityConfiguration(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *EMRSecurityConfiguration) Remove() error { +type EMRSecurityConfiguration struct { + svc *emr.EMR + name *string +} - //Call names are inconsistent in the SDK +func (f *EMRSecurityConfiguration) Remove(_ context.Context) error { + // Note: Call names are inconsistent in the SDK _, err := f.svc.DeleteSecurityConfiguration(&emr.DeleteSecurityConfigurationInput{ Name: f.name, }) diff --git a/resources/firehose-deliverystreams.go b/resources/firehose-deliverystreams.go index 831f457fd..c6fdd4cd0 100644 --- a/resources/firehose-deliverystreams.go +++ b/resources/firehose-deliverystreams.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/firehose" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type FirehoseDeliveryStream struct { - svc *firehose.Firehose - deliveryStreamName *string -} +const FirehoseDeliveryStreamResource = "FirehoseDeliveryStream" func init() { - register("FirehoseDeliveryStream", ListFirehoseDeliveryStreams) + resource.Register(resource.Registration{ + Name: FirehoseDeliveryStreamResource, + Scope: nuke.Account, + Lister: &FirehoseDeliveryStreamLister{}, + }) } -func ListFirehoseDeliveryStreams(sess *session.Session) ([]Resource, error) { - svc := firehose.New(sess) - resources := []Resource{} +type FirehoseDeliveryStreamLister struct{} + +func (l *FirehoseDeliveryStreamLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := firehose.New(opts.Session) + resources := make([]resource.Resource, 0) var lastDeliveryStreamName *string params := &firehose.ListDeliveryStreamsInput{ @@ -48,8 +58,12 @@ func ListFirehoseDeliveryStreams(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *FirehoseDeliveryStream) Remove() error { +type FirehoseDeliveryStream struct { + svc *firehose.Firehose + deliveryStreamName *string +} +func (f *FirehoseDeliveryStream) Remove(_ context.Context) error { _, err := f.svc.DeleteDeliveryStream(&firehose.DeleteDeliveryStreamInput{ DeliveryStreamName: f.deliveryStreamName, }) diff --git a/resources/fms_notification_channels.go b/resources/fms-notification-channels.go similarity index 53% rename from resources/fms_notification_channels.go rename to resources/fms-notification-channels.go index f7a832d0d..98402cb07 100644 --- a/resources/fms_notification_channels.go +++ b/resources/fms-notification-channels.go @@ -1,31 +1,42 @@ package resources import ( + "context" + + "errors" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/fms" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type FMSNotificationChannel struct { - svc *fms.FMS -} +const FMSNotificationChannelResource = "FMSNotificationChannel" func init() { - register("FMSNotificationChannel", ListFMSNotificationChannel) + resource.Register(resource.Registration{ + Name: FMSNotificationChannelResource, + Scope: nuke.Account, + Lister: &FMSNotificationChannelLister{}, + }) } -func ListFMSNotificationChannel(sess *session.Session) ([]Resource, error) { - svc := fms.New(sess) - resources := []Resource{} +type FMSNotificationChannelLister struct{} + +func (l *FMSNotificationChannelLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := fms.New(opts.Session) + resources := make([]resource.Resource, 0) if _, err := svc.GetNotificationChannel(&fms.GetNotificationChannelInput{}); err != nil { - if aerr, ok := err.(awserr.Error); ok { + var aerr awserr.Error + if errors.As(err, &aerr) { if aerr.Code() != fms.ErrCodeResourceNotFoundException { return nil, err } - } else { - return nil, err } } else { resources = append(resources, &FMSNotificationChannel{ @@ -36,8 +47,11 @@ func ListFMSNotificationChannel(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *FMSNotificationChannel) Remove() error { +type FMSNotificationChannel struct { + svc *fms.FMS +} +func (f *FMSNotificationChannel) Remove(_ context.Context) error { _, err := f.svc.DeleteNotificationChannel(&fms.DeleteNotificationChannelInput{}) return err diff --git a/resources/fms_policies.go b/resources/fms-policies.go similarity index 63% rename from resources/fms_policies.go rename to resources/fms-policies.go index f369518a3..c9d7587a1 100644 --- a/resources/fms_policies.go +++ b/resources/fms-policies.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/fms" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type FMSPolicy struct { - svc *fms.FMS - policy *fms.PolicySummary -} +const FMSPolicyResource = "FMSPolicy" func init() { - register("FMSPolicy", ListFMSPolicies) + resource.Register(resource.Registration{ + Name: FMSPolicyResource, + Scope: nuke.Account, + Lister: &FMSPolicyLister{}, + }) } -func ListFMSPolicies(sess *session.Session) ([]Resource, error) { - svc := fms.New(sess) - resources := []Resource{} +type FMSPolicyLister struct{} + +func (l *FMSPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := fms.New(opts.Session) + resources := make([]resource.Resource, 0) params := &fms.ListPoliciesInput{ MaxResults: aws.Int64(50), @@ -47,8 +57,12 @@ func ListFMSPolicies(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *FMSPolicy) Remove() error { +type FMSPolicy struct { + svc *fms.FMS + policy *fms.PolicySummary +} +func (f *FMSPolicy) Remove(_ context.Context) error { _, err := f.svc.DeletePolicy(&fms.DeletePolicyInput{ PolicyId: f.policy.PolicyId, DeleteAllPolicyResources: aws.Bool(false), diff --git a/resources/fsx-backups.go b/resources/fsx-backups.go index b3dae7aee..53bf07d63 100644 --- a/resources/fsx-backups.go +++ b/resources/fsx-backups.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/fsx" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type FSxBackup struct { - svc *fsx.FSx - backup *fsx.Backup -} +const FSxBackupResource = "FSxBackup" func init() { - register("FSxBackup", ListFSxBackups) + resource.Register(resource.Registration{ + Name: FSxBackupResource, + Scope: nuke.Account, + Lister: &FSxBackupLister{}, + }) } -func ListFSxBackups(sess *session.Session) ([]Resource, error) { - svc := fsx.New(sess) - resources := []Resource{} +type FSxBackupLister struct{} + +func (l *FSxBackupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := fsx.New(opts.Session) + resources := make([]resource.Resource, 0) params := &fsx.DescribeBackupsInput{ MaxResults: aws.Int64(100), @@ -45,7 +55,12 @@ func ListFSxBackups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *FSxBackup) Remove() error { +type FSxBackup struct { + svc *fsx.FSx + backup *fsx.Backup +} + +func (f *FSxBackup) Remove(_ context.Context) error { _, err := f.svc.DeleteBackup(&fsx.DeleteBackupInput{ BackupId: f.backup.BackupId, }) diff --git a/resources/fsx-filesystems.go b/resources/fsx-filesystems.go index 3fccf1210..ea06b90b6 100644 --- a/resources/fsx-filesystems.go +++ b/resources/fsx-filesystems.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/fsx" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type FSxFileSystem struct { - svc *fsx.FSx - filesystem *fsx.FileSystem -} +const FSxFileSystemResource = "FSxFileSystem" func init() { - register("FSxFileSystem", ListFSxFileSystems) + resource.Register(resource.Registration{ + Name: FSxFileSystemResource, + Scope: nuke.Account, + Lister: &FSxFileSystemLister{}, + }) } -func ListFSxFileSystems(sess *session.Session) ([]Resource, error) { - svc := fsx.New(sess) - resources := []Resource{} +type FSxFileSystemLister struct{} + +func (l *FSxFileSystemLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := fsx.New(opts.Session) + resources := make([]resource.Resource, 0) params := &fsx.DescribeFileSystemsInput{ MaxResults: aws.Int64(100), @@ -45,7 +55,12 @@ func ListFSxFileSystems(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *FSxFileSystem) Remove() error { +type FSxFileSystem struct { + svc *fsx.FSx + filesystem *fsx.FileSystem +} + +func (f *FSxFileSystem) Remove(_ context.Context) error { _, err := f.svc.DeleteFileSystem(&fsx.DeleteFileSystemInput{ FileSystemId: f.filesystem.FileSystemId, }) diff --git a/resources/ga-accelerators.go b/resources/ga-accelerators.go index 2ebfd50be..757172251 100644 --- a/resources/ga-accelerators.go +++ b/resources/ga-accelerators.go @@ -1,10 +1,14 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) // GlobalAccelerator model @@ -13,14 +17,24 @@ type GlobalAccelerator struct { ARN *string } +const GlobalAcceleratorResource = "GlobalAccelerator" + func init() { - register("GlobalAccelerator", ListGlobalAccelerators) + resource.Register(resource.Registration{ + Name: GlobalAcceleratorResource, + Scope: nuke.Account, + Lister: &GlobalAcceleratorLister{}, + }) } -// ListGlobalAccelerators enumerates all available accelerators -func ListGlobalAccelerators(sess *session.Session) ([]Resource, error) { - svc := globalaccelerator.New(sess) - resources := []Resource{} +type GlobalAcceleratorLister struct{} + +// List enumerates all available accelerators +func (l *GlobalAcceleratorLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := globalaccelerator.New(opts.Session) + resources := make([]resource.Resource, 0) params := &globalaccelerator.ListAcceleratorsInput{ MaxResults: aws.Int64(100), @@ -50,7 +64,7 @@ func ListGlobalAccelerators(sess *session.Session) ([]Resource, error) { } // Remove resource -func (ga *GlobalAccelerator) Remove() error { +func (ga *GlobalAccelerator) Remove(_ context.Context) error { accel, err := ga.svc.DescribeAccelerator(&globalaccelerator.DescribeAcceleratorInput{ AcceleratorArn: ga.ARN, }) diff --git a/resources/ga-endpoints.go b/resources/ga-endpoints.go index 105ae6d5d..36622ea6d 100644 --- a/resources/ga-endpoints.go +++ b/resources/ga-endpoints.go @@ -1,30 +1,39 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -// GlobalAcceleratorEndpointGroup model -type GlobalAcceleratorEndpointGroup struct { - svc *globalaccelerator.GlobalAccelerator - ARN *string -} +const GlobalAcceleratorEndpointGroupResource = "GlobalAcceleratorEndpointGroup" func init() { - register("GlobalAcceleratorEndpointGroup", ListGlobalAcceleratorEndpointGroups) + resource.Register(resource.Registration{ + Name: GlobalAcceleratorEndpointGroupResource, + Scope: nuke.Account, + Lister: &GlobalAcceleratorEndpointGroupLister{}, + }) } -// ListGlobalAcceleratorEndpointGroups enumerates all available accelerators -func ListGlobalAcceleratorEndpointGroups(sess *session.Session) ([]Resource, error) { - svc := globalaccelerator.New(sess) - acceleratorARNs := []*string{} - listenerARNs := []*string{} - resources := []Resource{} +type GlobalAcceleratorEndpointGroupLister struct{} - // get all accelerator arns +// List enumerates all available accelerators +func (l *GlobalAcceleratorEndpointGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := globalaccelerator.New(opts.Session) + var acceleratorARNs []*string + var listenerARNs []*string + resources := make([]resource.Resource, 0) + + // get all accelerator ARNs acceleratorParams := &globalaccelerator.ListAcceleratorsInput{ MaxResults: aws.Int64(100), } @@ -46,7 +55,7 @@ func ListGlobalAcceleratorEndpointGroups(sess *session.Session) ([]Resource, err acceleratorParams.NextToken = output.NextToken } - // get all listerners arns of all accelerators + // get all listeners ARNs of all accelerators for _, acceleratorARN := range acceleratorARNs { listenerParams := &globalaccelerator.ListListenersInput{ MaxResults: aws.Int64(100), @@ -102,23 +111,29 @@ func ListGlobalAcceleratorEndpointGroups(sess *session.Session) ([]Resource, err return resources, nil } +// GlobalAcceleratorEndpointGroup model +type GlobalAcceleratorEndpointGroup struct { + svc *globalaccelerator.GlobalAccelerator + ARN *string +} + // Remove resource -func (gaeg *GlobalAcceleratorEndpointGroup) Remove() error { - _, err := gaeg.svc.DeleteEndpointGroup(&globalaccelerator.DeleteEndpointGroupInput{ - EndpointGroupArn: gaeg.ARN, +func (g *GlobalAcceleratorEndpointGroup) Remove(_ context.Context) error { + _, err := g.svc.DeleteEndpointGroup(&globalaccelerator.DeleteEndpointGroupInput{ + EndpointGroupArn: g.ARN, }) return err } // Properties definition -func (gaeg *GlobalAcceleratorEndpointGroup) Properties() types.Properties { +func (g *GlobalAcceleratorEndpointGroup) Properties() types.Properties { properties := types.NewProperties() - properties.Set("ARN", gaeg.ARN) + properties.Set("ARN", g.ARN) return properties } // String representation -func (gaeg *GlobalAcceleratorEndpointGroup) String() string { - return *gaeg.ARN +func (g *GlobalAcceleratorEndpointGroup) String() string { + return *g.ARN } diff --git a/resources/ga-listeners.go b/resources/ga-listeners.go index 8eedb85e4..8bae2a98d 100644 --- a/resources/ga-listeners.go +++ b/resources/ga-listeners.go @@ -1,29 +1,38 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/globalaccelerator" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -// GlobalAcceleratorListener model -type GlobalAcceleratorListener struct { - svc *globalaccelerator.GlobalAccelerator - ARN *string -} +const GlobalAcceleratorListenerResource = "GlobalAcceleratorListener" func init() { - register("GlobalAcceleratorListener", ListGlobalAcceleratorListeners) + resource.Register(resource.Registration{ + Name: GlobalAcceleratorListenerResource, + Scope: nuke.Account, + Lister: &GlobalAcceleratorListenerLister{}, + }) } -// ListGlobalAcceleratorListeners enumerates all available listeners of all available accelerators -func ListGlobalAcceleratorListeners(sess *session.Session) ([]Resource, error) { - svc := globalaccelerator.New(sess) - acceleratorARNs := []*string{} - resources := []Resource{} +type GlobalAcceleratorListenerLister struct{} - // get all accelerator arns +// List enumerates all available listeners of all available accelerators +func (l *GlobalAcceleratorListenerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := globalaccelerator.New(opts.Session) + var acceleratorARNs []*string + resources := make([]resource.Resource, 0) + + // get all accelerator ARNs acceleratorParams := &globalaccelerator.ListAcceleratorsInput{ MaxResults: aws.Int64(100), } @@ -45,7 +54,7 @@ func ListGlobalAcceleratorListeners(sess *session.Session) ([]Resource, error) { acceleratorParams.NextToken = output.NextToken } - // get all listerners + // get all listeners for _, acceleratorARN := range acceleratorARNs { params := &globalaccelerator.ListListenersInput{ MaxResults: aws.Int64(100), @@ -76,23 +85,29 @@ func ListGlobalAcceleratorListeners(sess *session.Session) ([]Resource, error) { return resources, nil } +// GlobalAcceleratorListener model +type GlobalAcceleratorListener struct { + svc *globalaccelerator.GlobalAccelerator + ARN *string +} + // Remove resource -func (gal *GlobalAcceleratorListener) Remove() error { - _, err := gal.svc.DeleteListener(&globalaccelerator.DeleteListenerInput{ - ListenerArn: gal.ARN, +func (g *GlobalAcceleratorListener) Remove(_ context.Context) error { + _, err := g.svc.DeleteListener(&globalaccelerator.DeleteListenerInput{ + ListenerArn: g.ARN, }) return err } // Properties definition -func (gal *GlobalAcceleratorListener) Properties() types.Properties { +func (g *GlobalAcceleratorListener) Properties() types.Properties { properties := types.NewProperties() - properties.Set("ARN", gal.ARN) + properties.Set("ARN", g.ARN) return properties } // String representation -func (gal *GlobalAcceleratorListener) String() string { - return *gal.ARN +func (g *GlobalAcceleratorListener) String() string { + return *g.ARN } diff --git a/resources/glue-classifiers.go b/resources/glue-classifiers.go index 7f3fd18a4..d32767552 100644 --- a/resources/glue-classifiers.go +++ b/resources/glue-classifiers.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/glue" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueClassifier struct { - svc *glue.Glue - name *string -} +const GlueClassifierResource = "GlueClassifier" func init() { - register("GlueClassifier", ListGlueClassifiers) + resource.Register(resource.Registration{ + Name: GlueClassifierResource, + Scope: nuke.Account, + Lister: &GlueClassifierLister{}, + }) } -func ListGlueClassifiers(sess *session.Session) ([]Resource, error) { - svc := glue.New(sess) - resources := []Resource{} +type GlueClassifierLister struct{} + +func (l *GlueClassifierLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := glue.New(opts.Session) + resources := make([]resource.Resource, 0) params := &glue.GetClassifiersInput{ MaxResults: aws.Int64(100), @@ -58,8 +68,12 @@ func ListGlueClassifiers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueClassifier) Remove() error { +type GlueClassifier struct { + svc *glue.Glue + name *string +} +func (f *GlueClassifier) Remove(_ context.Context) error { _, err := f.svc.DeleteClassifier(&glue.DeleteClassifierInput{ Name: f.name, }) diff --git a/resources/glue-connections.go b/resources/glue-connections.go index c775727cf..d0f505d0e 100644 --- a/resources/glue-connections.go +++ b/resources/glue-connections.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/glue" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueConnection struct { - svc *glue.Glue - connectionName *string -} +const GlueConnectionResource = "GlueConnection" func init() { - register("GlueConnection", ListGlueConnections) + resource.Register(resource.Registration{ + Name: GlueConnectionResource, + Scope: nuke.Account, + Lister: &GlueConnectionLister{}, + }) } -func ListGlueConnections(sess *session.Session) ([]Resource, error) { - svc := glue.New(sess) - resources := []Resource{} +type GlueConnectionLister struct{} + +func (l *GlueConnectionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := glue.New(opts.Session) + resources := make([]resource.Resource, 0) params := &glue.GetConnectionsInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListGlueConnections(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueConnection) Remove() error { +type GlueConnection struct { + svc *glue.Glue + connectionName *string +} +func (f *GlueConnection) Remove(_ context.Context) error { _, err := f.svc.DeleteConnection(&glue.DeleteConnectionInput{ ConnectionName: f.connectionName, }) diff --git a/resources/glue-crawlers.go b/resources/glue-crawlers.go index 90a5f3a99..916603e67 100644 --- a/resources/glue-crawlers.go +++ b/resources/glue-crawlers.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/glue" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueCrawler struct { - svc *glue.Glue - name *string -} +const GlueCrawlerResource = "GlueCrawler" func init() { - register("GlueCrawler", ListGlueCrawlers) + resource.Register(resource.Registration{ + Name: GlueCrawlerResource, + Scope: nuke.Account, + Lister: &GlueCrawlerLister{}, + }) } -func ListGlueCrawlers(sess *session.Session) ([]Resource, error) { - svc := glue.New(sess) - resources := []Resource{} +type GlueCrawlerLister struct{} + +func (l *GlueCrawlerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := glue.New(opts.Session) + resources := make([]resource.Resource, 0) params := &glue.GetCrawlersInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListGlueCrawlers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueCrawler) Remove() error { +type GlueCrawler struct { + svc *glue.Glue + name *string +} +func (f *GlueCrawler) Remove(_ context.Context) error { _, err := f.svc.DeleteCrawler(&glue.DeleteCrawlerInput{ Name: f.name, }) diff --git a/resources/glue-databases.go b/resources/glue-databases.go index 3a924bdc3..12673a73a 100644 --- a/resources/glue-databases.go +++ b/resources/glue-databases.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/glue" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDatabase struct { - svc *glue.Glue - name *string -} +const GlueDatabaseResource = "GlueDatabase" func init() { - register("GlueDatabase", ListGlueDatabases) + resource.Register(resource.Registration{ + Name: GlueDatabaseResource, + Scope: nuke.Account, + Lister: &GlueDatabaseLister{}, + }) } -func ListGlueDatabases(sess *session.Session) ([]Resource, error) { - svc := glue.New(sess) - resources := []Resource{} +type GlueDatabaseLister struct{} + +func (l *GlueDatabaseLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := glue.New(opts.Session) + resources := make([]resource.Resource, 0) params := &glue.GetDatabasesInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListGlueDatabases(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDatabase) Remove() error { +type GlueDatabase struct { + svc *glue.Glue + name *string +} +func (f *GlueDatabase) Remove(_ context.Context) error { _, err := f.svc.DeleteDatabase(&glue.DeleteDatabaseInput{ Name: f.name, }) diff --git a/resources/glue-devendpoints.go b/resources/glue-devendpoints.go index 7b491f075..04c4b4ae8 100644 --- a/resources/glue-devendpoints.go +++ b/resources/glue-devendpoints.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/glue" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDevEndpoint struct { - svc *glue.Glue - endpointName *string -} +const GlueDevEndpointResource = "GlueDevEndpoint" func init() { - register("GlueDevEndpoint", ListGlueDevEndpoints) + resource.Register(resource.Registration{ + Name: GlueDevEndpointResource, + Scope: nuke.Account, + Lister: &GlueDevEndpointLister{}, + }) } -func ListGlueDevEndpoints(sess *session.Session) ([]Resource, error) { - svc := glue.New(sess) - resources := []Resource{} +type GlueDevEndpointLister struct{} + +func (l *GlueDevEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := glue.New(opts.Session) + resources := make([]resource.Resource, 0) params := &glue.GetDevEndpointsInput{ MaxResults: aws.Int64(100), @@ -47,8 +57,12 @@ func ListGlueDevEndpoints(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDevEndpoint) Remove() error { +type GlueDevEndpoint struct { + svc *glue.Glue + endpointName *string +} +func (f *GlueDevEndpoint) Remove(_ context.Context) error { _, err := f.svc.DeleteDevEndpoint(&glue.DeleteDevEndpointInput{ EndpointName: f.endpointName, }) diff --git a/resources/glue-jobs.go b/resources/glue-jobs.go index ec25e3583..af6a7e377 100644 --- a/resources/glue-jobs.go +++ b/resources/glue-jobs.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/glue" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueJob struct { - svc *glue.Glue - jobName *string -} +const GlueJobResource = "GlueJob" func init() { - register("GlueJob", ListGlueJobs) + resource.Register(resource.Registration{ + Name: GlueJobResource, + Scope: nuke.Account, + Lister: &GlueJobLister{}, + }) } -func ListGlueJobs(sess *session.Session) ([]Resource, error) { - svc := glue.New(sess) - resources := []Resource{} +type GlueJobLister struct{} + +func (l *GlueJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := glue.New(opts.Session) + resources := make([]resource.Resource, 0) params := &glue.GetJobsInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListGlueJobs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueJob) Remove() error { +type GlueJob struct { + svc *glue.Glue + jobName *string +} +func (f *GlueJob) Remove(_ context.Context) error { _, err := f.svc.DeleteJob(&glue.DeleteJobInput{ JobName: f.jobName, }) diff --git a/resources/glue-triggers.go b/resources/glue-triggers.go index 410d55a05..3556ba627 100644 --- a/resources/glue-triggers.go +++ b/resources/glue-triggers.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/glue" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueTrigger struct { - svc *glue.Glue - name *string -} +const GlueTriggerResource = "GlueTrigger" func init() { - register("GlueTrigger", ListGlueTriggers) + resource.Register(resource.Registration{ + Name: GlueTriggerResource, + Scope: nuke.Account, + Lister: &GlueTriggerLister{}, + }) } -func ListGlueTriggers(sess *session.Session) ([]Resource, error) { - svc := glue.New(sess) - resources := []Resource{} +type GlueTriggerLister struct{} + +func (l *GlueTriggerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := glue.New(opts.Session) + resources := make([]resource.Resource, 0) params := &glue.GetTriggersInput{ MaxResults: aws.Int64(100), @@ -46,7 +56,12 @@ func ListGlueTriggers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueTrigger) Remove() error { +type GlueTrigger struct { + svc *glue.Glue + name *string +} + +func (f *GlueTrigger) Remove(_ context.Context) error { _, err := f.svc.DeleteTrigger(&glue.DeleteTriggerInput{ Name: f.name, diff --git a/resources/gluedatabrew-datasets.go b/resources/gluedatabrew-datasets.go index 72353b64f..53ede302a 100644 --- a/resources/gluedatabrew-datasets.go +++ b/resources/gluedatabrew-datasets.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/gluedatabrew" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDataBrewDatasets struct { - svc *gluedatabrew.GlueDataBrew - name *string -} +const GlueDataBrewDatasetsResource = "GlueDataBrewDatasets" func init() { - register("GlueDataBrewDatasets", ListGlueDatasets) + resource.Register(resource.Registration{ + Name: GlueDataBrewDatasetsResource, + Scope: nuke.Account, + Lister: &GlueDataBrewDatasetsLister{}, + }) } -func ListGlueDatasets(sess *session.Session) ([]Resource, error) { - svc := gluedatabrew.New(sess) - resources := []Resource{} +type GlueDataBrewDatasetsLister struct{} + +func (l *GlueDataBrewDatasetsLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := gluedatabrew.New(opts.Session) + resources := make([]resource.Resource, 0) params := &gluedatabrew.ListDatasetsInput{ MaxResults: aws.Int64(100), @@ -46,7 +56,12 @@ func ListGlueDatasets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDataBrewDatasets) Remove() error { +type GlueDataBrewDatasets struct { + svc *gluedatabrew.GlueDataBrew + name *string +} + +func (f *GlueDataBrewDatasets) Remove(_ context.Context) error { _, err := f.svc.DeleteDataset(&gluedatabrew.DeleteDatasetInput{ Name: f.name, }) diff --git a/resources/gluedatabrew-jobs.go b/resources/gluedatabrew-jobs.go index b4da5f052..f700b85cb 100644 --- a/resources/gluedatabrew-jobs.go +++ b/resources/gluedatabrew-jobs.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/gluedatabrew" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDataBrewJobs struct { - svc *gluedatabrew.GlueDataBrew - name *string -} +const GlueDataBrewJobsResource = "GlueDataBrewJobs" func init() { - register("GlueDataBrewJobs", ListGlueDataBrewJobs) + resource.Register(resource.Registration{ + Name: GlueDataBrewJobsResource, + Scope: nuke.Account, + Lister: &GlueDataBrewJobsLister{}, + }) } -func ListGlueDataBrewJobs(sess *session.Session) ([]Resource, error) { - svc := gluedatabrew.New(sess) - resources := []Resource{} +type GlueDataBrewJobsLister struct{} + +func (l *GlueDataBrewJobsLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := gluedatabrew.New(opts.Session) + resources := make([]resource.Resource, 0) params := &gluedatabrew.ListJobsInput{ MaxResults: aws.Int64(100), @@ -46,7 +56,12 @@ func ListGlueDataBrewJobs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDataBrewJobs) Remove() error { +type GlueDataBrewJobs struct { + svc *gluedatabrew.GlueDataBrew + name *string +} + +func (f *GlueDataBrewJobs) Remove(_ context.Context) error { _, err := f.svc.DeleteJob(&gluedatabrew.DeleteJobInput{ Name: f.name, }) diff --git a/resources/gluedatabrew-projects.go b/resources/gluedatabrew-projects.go index 3ea8ec4f8..6c6e4588b 100644 --- a/resources/gluedatabrew-projects.go +++ b/resources/gluedatabrew-projects.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/gluedatabrew" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDataBrewProjects struct { - svc *gluedatabrew.GlueDataBrew - name *string -} +const GlueDataBrewProjectsResource = "GlueDataBrewProjects" func init() { - register("GlueDataBrewProjects", ListGlueDataBrewProjects) + resource.Register(resource.Registration{ + Name: GlueDataBrewProjectsResource, + Scope: nuke.Account, + Lister: &GlueDataBrewProjectsLister{}, + }) } -func ListGlueDataBrewProjects(sess *session.Session) ([]Resource, error) { - svc := gluedatabrew.New(sess) - resources := []Resource{} +type GlueDataBrewProjectsLister struct{} + +func (l *GlueDataBrewProjectsLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := gluedatabrew.New(opts.Session) + resources := make([]resource.Resource, 0) params := &gluedatabrew.ListProjectsInput{ MaxResults: aws.Int64(100), @@ -46,7 +56,12 @@ func ListGlueDataBrewProjects(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDataBrewProjects) Remove() error { +type GlueDataBrewProjects struct { + svc *gluedatabrew.GlueDataBrew + name *string +} + +func (f *GlueDataBrewProjects) Remove(_ context.Context) error { _, err := f.svc.DeleteProject(&gluedatabrew.DeleteProjectInput{ Name: f.name, }) diff --git a/resources/gluedatabrew-recipe.go b/resources/gluedatabrew-recipe.go index 8bc8331f4..967448dc7 100644 --- a/resources/gluedatabrew-recipe.go +++ b/resources/gluedatabrew-recipe.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/gluedatabrew" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDataBrewRecipe struct { - svc *gluedatabrew.GlueDataBrew - name *string - recipeversion *string -} +const GlueDataBrewRecipeResource = "GlueDataBrewRecipe" func init() { - register("GlueDataBrewRecipe", ListGlueDataBrewRecipe) + resource.Register(resource.Registration{ + Name: GlueDataBrewRecipeResource, + Scope: nuke.Account, + Lister: &GlueDataBrewRecipeLister{}, + }) } -func ListGlueDataBrewRecipe(sess *session.Session) ([]Resource, error) { - svc := gluedatabrew.New(sess) - resources := []Resource{} +type GlueDataBrewRecipeLister struct{} + +func (l *GlueDataBrewRecipeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := gluedatabrew.New(opts.Session) + resources := make([]resource.Resource, 0) params := &gluedatabrew.ListRecipesInput{ MaxResults: aws.Int64(100), @@ -34,7 +43,7 @@ func ListGlueDataBrewRecipe(sess *session.Session) ([]Resource, error) { resources = append(resources, &GlueDataBrewRecipe{ svc: svc, name: recipe.Name, - recipeversion: recipe.RecipeVersion, + recipeVersion: recipe.RecipeVersion, }) } @@ -48,10 +57,16 @@ func ListGlueDataBrewRecipe(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDataBrewRecipe) Remove() error { +type GlueDataBrewRecipe struct { + svc *gluedatabrew.GlueDataBrew + name *string + recipeVersion *string +} + +func (f *GlueDataBrewRecipe) Remove(_ context.Context) error { _, err := f.svc.DeleteRecipeVersion(&gluedatabrew.DeleteRecipeVersionInput{ Name: f.name, - RecipeVersion: f.recipeversion, + RecipeVersion: f.recipeVersion, }) return err diff --git a/resources/gluedatabrew-rulesets.go b/resources/gluedatabrew-rulesets.go index 24bbeb522..a00d1a11c 100644 --- a/resources/gluedatabrew-rulesets.go +++ b/resources/gluedatabrew-rulesets.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/gluedatabrew" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDataBrewRulesets struct { - svc *gluedatabrew.GlueDataBrew - name *string -} +const GlueDataBrewRulesetsResource = "GlueDataBrewRulesets" func init() { - register("GlueDataBrewRulesets", ListGlueDataBrewRulesets) + resource.Register(resource.Registration{ + Name: GlueDataBrewRulesetsResource, + Scope: nuke.Account, + Lister: &GlueDataBrewRulesetsLister{}, + }) } -func ListGlueDataBrewRulesets(sess *session.Session) ([]Resource, error) { - svc := gluedatabrew.New(sess) - resources := []Resource{} +type GlueDataBrewRulesetsLister struct{} + +func (l *GlueDataBrewRulesetsLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := gluedatabrew.New(opts.Session) + resources := make([]resource.Resource, 0) params := &gluedatabrew.ListRulesetsInput{ MaxResults: aws.Int64(100), @@ -46,7 +56,12 @@ func ListGlueDataBrewRulesets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDataBrewRulesets) Remove() error { +type GlueDataBrewRulesets struct { + svc *gluedatabrew.GlueDataBrew + name *string +} + +func (f *GlueDataBrewRulesets) Remove(_ context.Context) error { _, err := f.svc.DeleteRuleset(&gluedatabrew.DeleteRulesetInput{ Name: f.name, }) diff --git a/resources/gluedatabrew-schedules.go b/resources/gluedatabrew-schedules.go index bfdd07819..9b24eb87b 100644 --- a/resources/gluedatabrew-schedules.go +++ b/resources/gluedatabrew-schedules.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/gluedatabrew" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GlueDataBrewSchedules struct { - svc *gluedatabrew.GlueDataBrew - name *string -} +const GlueDataBrewSchedulesResource = "GlueDataBrewSchedules" func init() { - register("GlueDataBrewSchedules", ListGlueDataBrewSchedules) + resource.Register(resource.Registration{ + Name: GlueDataBrewSchedulesResource, + Scope: nuke.Account, + Lister: &GlueDataBrewSchedulesLister{}, + }) } -func ListGlueDataBrewSchedules(sess *session.Session) ([]Resource, error) { - svc := gluedatabrew.New(sess) - resources := []Resource{} +type GlueDataBrewSchedulesLister struct{} + +func (l *GlueDataBrewSchedulesLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := gluedatabrew.New(opts.Session) + resources := make([]resource.Resource, 0) params := &gluedatabrew.ListSchedulesInput{ MaxResults: aws.Int64(100), @@ -46,7 +56,12 @@ func ListGlueDataBrewSchedules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *GlueDataBrewSchedules) Remove() error { +type GlueDataBrewSchedules struct { + svc *gluedatabrew.GlueDataBrew + name *string +} + +func (f *GlueDataBrewSchedules) Remove(_ context.Context) error { _, err := f.svc.DeleteSchedule(&gluedatabrew.DeleteScheduleInput{ Name: f.name, }) diff --git a/resources/guardduty.go b/resources/guardduty.go index 8a40ed2d9..ae0594a60 100644 --- a/resources/guardduty.go +++ b/resources/guardduty.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/guardduty" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type GuardDutyDetector struct { - svc *guardduty.GuardDuty - id *string -} +const GuardDutyDetectorResource = "GuardDutyDetector" func init() { - register("GuardDutyDetector", ListGuardDutyDetectors) + resource.Register(resource.Registration{ + Name: GuardDutyDetectorResource, + Scope: nuke.Account, + Lister: &GuardDutyDetectorLister{}, + }) } -func ListGuardDutyDetectors(sess *session.Session) ([]Resource, error) { - svc := guardduty.New(sess) +type GuardDutyDetectorLister struct{} - detectors := make([]Resource, 0) +func (l *GuardDutyDetectorLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := guardduty.New(opts.Session) + + detectors := make([]resource.Resource, 0) params := &guardduty.ListDetectorsInput{} @@ -37,19 +47,24 @@ func ListGuardDutyDetectors(sess *session.Session) ([]Resource, error) { return detectors, nil } -func (detector *GuardDutyDetector) Remove() error { - _, err := detector.svc.DeleteDetector(&guardduty.DeleteDetectorInput{ - DetectorId: detector.id, +type GuardDutyDetector struct { + svc *guardduty.GuardDuty + id *string +} + +func (r *GuardDutyDetector) Remove(_ context.Context) error { + _, err := r.svc.DeleteDetector(&guardduty.DeleteDetectorInput{ + DetectorId: r.id, }) return err } -func (detector *GuardDutyDetector) Properties() types.Properties { +func (r *GuardDutyDetector) Properties() types.Properties { properties := types.NewProperties() - properties.Set("DetectorID", detector.id) + properties.Set("DetectorID", r.id) return properties } -func (detector *GuardDutyDetector) String() string { - return *detector.id +func (r *GuardDutyDetector) String() string { + return *r.id } diff --git a/resources/iam-account-setting-password-policy.go b/resources/iam-account-setting-password-policy.go index 7336d184d..d0a1176d3 100644 --- a/resources/iam-account-setting-password-policy.go +++ b/resources/iam-account-setting-password-policy.go @@ -1,30 +1,43 @@ package resources import ( + "context" + + "errors" + "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMAccountSettingPasswordPolicy struct { - svc iamiface.IAMAPI - policy *iam.PasswordPolicy -} +const IAMAccountSettingPasswordPolicyResource = "IAMAccountSettingPasswordPolicy" func init() { - register("IAMAccountSettingPasswordPolicy", ListIAMAccountSettingPasswordPolicy) + resource.Register(resource.Registration{ + Name: IAMAccountSettingPasswordPolicyResource, + Scope: nuke.Account, + Lister: &IAMAccountSettingPasswordPolicyLister{}, + }) } -func ListIAMAccountSettingPasswordPolicy(sess *session.Session) ([]Resource, error) { - resources := make([]Resource, 0) +type IAMAccountSettingPasswordPolicyLister struct{} - svc := iam.New(sess) +func (l *IAMAccountSettingPasswordPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + resources := make([]resource.Resource, 0) + + svc := iam.New(opts.Session) resp, err := svc.GetAccountPasswordPolicy(&iam.GetAccountPasswordPolicyInput{}) if err != nil { - if aerr, ok := err.(awserr.Error); ok { + var aerr awserr.Error + if errors.As(err, &aerr) { switch aerr.Code() { case iam.ErrCodeNoSuchEntityException: return nil, nil @@ -44,11 +57,17 @@ func ListIAMAccountSettingPasswordPolicy(sess *session.Session) ([]Resource, err return resources, nil } -func (e *IAMAccountSettingPasswordPolicy) Remove() error { +type IAMAccountSettingPasswordPolicy struct { + svc iamiface.IAMAPI + policy *iam.PasswordPolicy +} + +func (e *IAMAccountSettingPasswordPolicy) Remove(_ context.Context) error { _, err := e.svc.DeleteAccountPasswordPolicy(&iam.DeleteAccountPasswordPolicyInput{}) if err != nil { return err } + return nil } diff --git a/resources/iam-group-policies.go b/resources/iam-group-policies.go index 5a10e1f1d..fd8b02d27 100644 --- a/resources/iam-group-policies.go +++ b/resources/iam-group-policies.go @@ -1,32 +1,40 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMGroupPolicy struct { - svc iamiface.IAMAPI - policyName string - groupName string -} +const IAMGroupPolicyResource = "IAMGroupPolicy" func init() { - register("IAMGroupPolicy", ListIAMGroupPolicies) + resource.Register(resource.Registration{ + Name: IAMGroupPolicyResource, + Scope: nuke.Account, + Lister: &IAMGroupPolicyLister{}, + }) } -func ListIAMGroupPolicies(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMGroupPolicyLister struct{} +func (l *IAMGroupPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) resp, err := svc.ListGroups(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, group := range resp.Groups { resp, err := svc.ListGroupPolicies( &iam.ListGroupPoliciesInput{ @@ -48,7 +56,13 @@ func ListIAMGroupPolicies(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMGroupPolicy) Remove() error { +type IAMGroupPolicy struct { + svc iamiface.IAMAPI + policyName string + groupName string +} + +func (e *IAMGroupPolicy) Remove(_ context.Context) error { _, err := e.svc.DeleteGroupPolicy( &iam.DeleteGroupPolicyInput{ PolicyName: &e.policyName, diff --git a/resources/iam-group-policies_mock_test.go b/resources/iam-group-policies_mock_test.go index baba41f9d..eee966a72 100644 --- a/resources/iam-group-policies_mock_test.go +++ b/resources/iam-group-policies_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMGroupPolicy_Remove(t *testing.T) { @@ -28,6 +31,6 @@ func Test_Mock_IAMGroupPolicy_Remove(t *testing.T) { GroupName: aws.String(iamGroupPolicy.groupName), })).Return(&iam.DeleteGroupPolicyOutput{}, nil) - err := iamGroupPolicy.Remove() + err := iamGroupPolicy.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-group-policy-attachments.go b/resources/iam-group-policy-attachments.go index 46cd2bb81..038516a1c 100644 --- a/resources/iam-group-policy-attachments.go +++ b/resources/iam-group-policy-attachments.go @@ -1,34 +1,42 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMGroupPolicyAttachment struct { - svc iamiface.IAMAPI - policyArn string - policyName string - groupName string -} +const IAMGroupPolicyAttachmentResource = "IAMGroupPolicyAttachment" func init() { - register("IAMGroupPolicyAttachment", ListIAMGroupPolicyAttachments) + resource.Register(resource.Registration{ + Name: IAMGroupPolicyAttachmentResource, + Scope: nuke.Account, + Lister: &IAMGroupPolicyAttachmentLister{}, + }) } -func ListIAMGroupPolicyAttachments(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMGroupPolicyAttachmentLister struct{} + +func (l *IAMGroupPolicyAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) resp, err := svc.ListGroups(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, role := range resp.Groups { resp, err := svc.ListAttachedGroupPolicies( &iam.ListAttachedGroupPoliciesInput{ @@ -51,7 +59,14 @@ func ListIAMGroupPolicyAttachments(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMGroupPolicyAttachment) Remove() error { +type IAMGroupPolicyAttachment struct { + svc iamiface.IAMAPI + policyArn string + policyName string + groupName string +} + +func (e *IAMGroupPolicyAttachment) Remove(_ context.Context) error { _, err := e.svc.DetachGroupPolicy( &iam.DetachGroupPolicyInput{ PolicyArn: &e.policyArn, diff --git a/resources/iam-group-policy-attachments_mock_test.go b/resources/iam-group-policy-attachments_mock_test.go index f068b0d30..145344a28 100644 --- a/resources/iam-group-policy-attachments_mock_test.go +++ b/resources/iam-group-policy-attachments_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMGroupPolicyAttachment_Remove(t *testing.T) { @@ -29,6 +32,6 @@ func Test_Mock_IAMGroupPolicyAttachment_Remove(t *testing.T) { GroupName: aws.String(iamGroupPolicyAttachment.groupName), })).Return(&iam.DetachGroupPolicyOutput{}, nil) - err := iamGroupPolicyAttachment.Remove() + err := iamGroupPolicyAttachment.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-groups.go b/resources/iam-groups.go index e88889cea..b82236489 100644 --- a/resources/iam-groups.go +++ b/resources/iam-groups.go @@ -1,12 +1,31 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMGroupResource = "IAMGroup" + +func init() { + resource.Register(resource.Registration{ + Name: IAMGroupResource, + Scope: nuke.Account, + Lister: &IAMGroupLister{}, + DependsOn: []string{ + IAMUserGroupAttachmentResource, + IAMGroupPolicyResource, + }, + }) +} + type IAMGroup struct { svc iamiface.IAMAPI id string @@ -14,33 +33,7 @@ type IAMGroup struct { path string } -func init() { - register("IAMGroup", ListIAMGroups) -} - -func ListIAMGroups(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) - resources := []Resource{} - - err := svc.ListGroupsPages(nil, func(page *iam.ListGroupsOutput, lastPage bool) bool { - for _, out := range page.Groups { - resources = append(resources, &IAMGroup{ - svc: svc, - id: *out.GroupId, - name: *out.GroupName, - path: *out.Path, - }) - } - return true - }) - if err != nil { - return nil, err - } - - return resources, nil -} - -func (e *IAMGroup) Remove() error { +func (e *IAMGroup) Remove(_ context.Context) error { _, err := e.svc.DeleteGroup(&iam.DeleteGroupInput{ GroupName: &e.name, }) @@ -61,3 +54,30 @@ func (e *IAMGroup) Properties() types.Properties { Set("Path", e.path). Set("ID", e.id) } + +// -------------- + +type IAMGroupLister struct{} + +func (l *IAMGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) + var resources []resource.Resource + + if err := svc.ListGroupsPages(nil, func(page *iam.ListGroupsOutput, lastPage bool) bool { + for _, out := range page.Groups { + resources = append(resources, &IAMGroup{ + svc: svc, + id: *out.GroupId, + name: *out.GroupName, + path: *out.Path, + }) + } + return true + }); err != nil { + return nil, err + } + + return resources, nil +} diff --git a/resources/iam-groups_mock_test.go b/resources/iam-groups_mock_test.go index 83dd9d212..83a2b3628 100644 --- a/resources/iam-groups_mock_test.go +++ b/resources/iam-groups_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMGroup_Remove(t *testing.T) { @@ -26,6 +29,6 @@ func Test_Mock_IAMGroup_Remove(t *testing.T) { GroupName: aws.String(iamGroup.name), })).Return(&iam.DeleteGroupOutput{}, nil) - err := iamGroup.Remove() + err := iamGroup.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-instance-profile-role_mock_test.go b/resources/iam-instance-profile-role_mock_test.go index 2ed83f33f..897f993a1 100644 --- a/resources/iam-instance-profile-role_mock_test.go +++ b/resources/iam-instance-profile-role_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMInstanceProfileRole_Remove(t *testing.T) { @@ -18,18 +21,20 @@ func Test_Mock_IAMInstanceProfileRole_Remove(t *testing.T) { mockIAM := mock_iamiface.NewMockIAMAPI(ctrl) iamInstanceProfileRole := IAMInstanceProfileRole{ - svc: mockIAM, - role: "role:foobar", + svc: mockIAM, + role: &iam.Role{ + RoleName: aws.String("role:foobar"), + }, profile: &iam.InstanceProfile{ InstanceProfileName: aws.String("profile:foobar"), }, } mockIAM.EXPECT().RemoveRoleFromInstanceProfile(gomock.Eq(&iam.RemoveRoleFromInstanceProfileInput{ - RoleName: aws.String(iamInstanceProfileRole.role), + RoleName: iamInstanceProfileRole.role.RoleName, InstanceProfileName: iamInstanceProfileRole.profile.InstanceProfileName, })).Return(&iam.RemoveRoleFromInstanceProfileOutput{}, nil) - err := iamInstanceProfileRole.Remove() + err := iamInstanceProfileRole.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-instance-profile-roles.go b/resources/iam-instance-profile-roles.go index 3f9f9d093..1b775d7f3 100644 --- a/resources/iam-instance-profile-roles.go +++ b/resources/iam-instance-profile-roles.go @@ -1,30 +1,41 @@ package resources import ( + "context" + "fmt" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" "time" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/gotidy/ptr" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMInstanceProfileRole struct { - svc iamiface.IAMAPI - role *iam.Role - profile *iam.InstanceProfile -} +const IAMInstanceProfileRoleResource = "IAMInstanceProfileRole" func init() { - register("IAMInstanceProfileRole", ListIAMInstanceProfileRoles) + resource.Register(resource.Registration{ + Name: IAMInstanceProfileRoleResource, + Scope: nuke.Account, + Lister: &IAMInstanceProfileRoleLister{}, + }) } -func ListIAMInstanceProfileRoles(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMInstanceProfileRoleLister struct{} + +func (l *IAMInstanceProfileRoleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) params := &iam.ListInstanceProfilesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListInstanceProfiles(params) @@ -61,7 +72,13 @@ func ListIAMInstanceProfileRoles(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMInstanceProfileRole) Remove() error { +type IAMInstanceProfileRole struct { + svc iamiface.IAMAPI + role *iam.Role + profile *iam.InstanceProfile +} + +func (e *IAMInstanceProfileRole) Remove(_ context.Context) error { _, err := e.svc.RemoveRoleFromInstanceProfile( &iam.RemoveRoleFromInstanceProfileInput{ InstanceProfileName: e.profile.InstanceProfileName, @@ -75,7 +92,7 @@ func (e *IAMInstanceProfileRole) Remove() error { } func (e *IAMInstanceProfileRole) String() string { - return fmt.Sprintf("%s -> %s", *e.profile.InstanceProfileName, e.role) + return fmt.Sprintf("%s -> %s", ptr.ToString(e.profile.InstanceProfileName), ptr.ToString(e.role.RoleName)) } func (e *IAMInstanceProfileRole) Properties() types.Properties { @@ -95,5 +112,6 @@ func (e *IAMInstanceProfileRole) Properties() types.Properties { for _, tagValue := range e.role.Tags { properties.SetTagWithPrefix("role", tagValue.Key, tagValue.Value) } + return properties } diff --git a/resources/iam-instance-profiles.go b/resources/iam-instance-profiles.go index 5b6542c04..ae46174fa 100644 --- a/resources/iam-instance-profiles.go +++ b/resources/iam-instance-profiles.go @@ -1,36 +1,37 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMInstanceProfile struct { - svc iamiface.IAMAPI - name string - path string - profile *iam.InstanceProfile -} +const IAMInstanceProfileResource = "IAMInstanceProfile" func init() { - register("IAMInstanceProfile", ListIAMInstanceProfiles) + resource.Register(resource.Registration{ + Name: IAMInstanceProfileResource, + Scope: nuke.Account, + Lister: &IAMInstanceProfileLister{}, + }) } -func GetIAMInstanceProfile(svc *iam.IAM, instanceProfileName *string) (*iam.InstanceProfile, error) { - params := &iam.GetInstanceProfileInput{ - InstanceProfileName: instanceProfileName, - } - resp, err := svc.GetInstanceProfile(params) - return resp.InstanceProfile, err -} +type IAMInstanceProfileLister struct{} + +func (l *IAMInstanceProfileLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) -func ListIAMInstanceProfiles(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) + svc := iam.New(opts.Session) params := &iam.ListInstanceProfilesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListInstanceProfiles(params) @@ -66,7 +67,22 @@ func ListIAMInstanceProfiles(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMInstanceProfile) Remove() error { +func GetIAMInstanceProfile(svc *iam.IAM, instanceProfileName *string) (*iam.InstanceProfile, error) { + params := &iam.GetInstanceProfileInput{ + InstanceProfileName: instanceProfileName, + } + resp, err := svc.GetInstanceProfile(params) + return resp.InstanceProfile, err +} + +type IAMInstanceProfile struct { + svc iamiface.IAMAPI + name string + path string + profile *iam.InstanceProfile +} + +func (e *IAMInstanceProfile) Remove(_ context.Context) error { _, err := e.svc.DeleteInstanceProfile(&iam.DeleteInstanceProfileInput{ InstanceProfileName: &e.name, }) diff --git a/resources/iam-instance-profiles_mock_test.go b/resources/iam-instance-profiles_mock_test.go index 6ae79ccba..263f36d17 100644 --- a/resources/iam-instance-profiles_mock_test.go +++ b/resources/iam-instance-profiles_mock_test.go @@ -1,13 +1,17 @@ package resources import ( + "context" + "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMInstanceProfile_Remove(t *testing.T) { @@ -26,6 +30,6 @@ func Test_Mock_IAMInstanceProfile_Remove(t *testing.T) { InstanceProfileName: aws.String(iamInstanceProfile.name), })).Return(&iam.DeleteInstanceProfileOutput{}, nil) - err := iamInstanceProfile.Remove() + err := iamInstanceProfile.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-login-profiles.go b/resources/iam-login-profiles.go index f162aaa4f..faa53dd21 100644 --- a/resources/iam-login-profiles.go +++ b/resources/iam-login-profiles.go @@ -1,37 +1,51 @@ package resources import ( + "context" + + "errors" + + "github.com/gotidy/ptr" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMLoginProfile struct { - svc iamiface.IAMAPI - name string -} +const IAMLoginProfileResource = "IAMLoginProfile" func init() { - register("IAMLoginProfile", ListIAMLoginProfiles) + resource.Register(resource.Registration{ + Name: IAMLoginProfileResource, + Scope: nuke.Account, + Lister: &IAMLoginProfileLister{}, + }) } -func ListIAMLoginProfiles(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMLoginProfileLister struct{} + +func (l *IAMLoginProfileLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := iam.New(opts.Session) resp, err := svc.ListUsers(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.Users { lpresp, err := svc.GetLoginProfile(&iam.GetLoginProfileInput{UserName: out.UserName}) if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { + var awsError awserr.Error + if errors.As(err, &awsError) { + switch awsError.Code() { case iam.ErrCodeNoSuchEntityException: // The user does not have a login profile and we do not // need to print an error for that. @@ -40,14 +54,14 @@ func ListIAMLoginProfiles(sess *session.Session) ([]Resource, error) { } logrus.Errorf("failed to list login profile for user %s: %v", - *out.UserName, err) + ptr.ToString(out.UserName), err) continue } if lpresp.LoginProfile != nil { resources = append(resources, &IAMLoginProfile{ svc: svc, - name: *out.UserName, + name: ptr.ToString(out.UserName), }) } } @@ -55,7 +69,12 @@ func ListIAMLoginProfiles(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMLoginProfile) Remove() error { +type IAMLoginProfile struct { + svc iamiface.IAMAPI + name string +} + +func (e *IAMLoginProfile) Remove(_ context.Context) error { _, err := e.svc.DeleteLoginProfile(&iam.DeleteLoginProfileInput{UserName: &e.name}) if err != nil { return err diff --git a/resources/iam-login-profiles_mock_test.go b/resources/iam-login-profiles_mock_test.go index 91c04d70a..db6d01618 100644 --- a/resources/iam-login-profiles_mock_test.go +++ b/resources/iam-login-profiles_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMLoginProfile_Remove(t *testing.T) { @@ -26,6 +29,6 @@ func Test_Mock_IAMLoginProfile_Remove(t *testing.T) { UserName: aws.String(iamLoginProfile.name), })).Return(&iam.DeleteLoginProfileOutput{}, nil) - err := iamLoginProfile.Remove() + err := iamLoginProfile.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-open-id-connect-provider.go b/resources/iam-open-id-connect-provider.go index 84ff288b3..e6455fb9e 100644 --- a/resources/iam-open-id-connect-provider.go +++ b/resources/iam-open-id-connect-provider.go @@ -1,34 +1,43 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMOpenIDConnectProvider struct { - svc iamiface.IAMAPI - arn string - tags []*iam.Tag -} +const IAMOpenIDConnectProviderResource = "IAMOpenIDConnectProvider" func init() { - register("IAMOpenIDConnectProvider", ListIAMOpenIDConnectProvider) + resource.Register(resource.Registration{ + Name: IAMOpenIDConnectProviderResource, + Scope: nuke.Account, + Lister: &IAMOpenIDConnectProviderLister{}, + }) } -func ListIAMOpenIDConnectProvider(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) - params := &iam.ListOpenIDConnectProvidersInput{} - resources := make([]Resource, 0) +type IAMOpenIDConnectProviderLister struct{} + +func (l *IAMOpenIDConnectProviderLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - resp, err := svc.ListOpenIDConnectProviders(params) + svc := iam.New(opts.Session) + + listParams := &iam.ListOpenIDConnectProvidersInput{} + resources := make([]resource.Resource, 0) + + resp, err := svc.ListOpenIDConnectProviders(listParams) if err != nil { return nil, err } for _, out := range resp.OpenIDConnectProviderList { - params := &iam.GetOpenIDConnectProviderInput{ OpenIDConnectProviderArn: out.Arn, } @@ -48,7 +57,13 @@ func ListIAMOpenIDConnectProvider(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMOpenIDConnectProvider) Remove() error { +type IAMOpenIDConnectProvider struct { + svc iamiface.IAMAPI + arn string + tags []*iam.Tag +} + +func (e *IAMOpenIDConnectProvider) Remove(_ context.Context) error { _, err := e.svc.DeleteOpenIDConnectProvider(&iam.DeleteOpenIDConnectProviderInput{ OpenIDConnectProviderArn: &e.arn, }) diff --git a/resources/iam-open-id-connect-provider_mock_test.go b/resources/iam-open-id-connect-provider_mock_test.go index 0f6a68d08..5ffff0bba 100644 --- a/resources/iam-open-id-connect-provider_mock_test.go +++ b/resources/iam-open-id-connect-provider_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMOpenIDConnectProvider_Remove(t *testing.T) { @@ -26,6 +29,6 @@ func Test_Mock_IAMOpenIDConnectProvider_Remove(t *testing.T) { OpenIDConnectProviderArn: aws.String(iamOpenIDConnectProvider.arn), })).Return(&iam.DeleteOpenIDConnectProviderOutput{}, nil) - err := iamOpenIDConnectProvider.Remove() + err := iamOpenIDConnectProvider.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-policies.go b/resources/iam-policies.go index cbb9cd7b4..aa09af809 100644 --- a/resources/iam-policies.go +++ b/resources/iam-policies.go @@ -1,14 +1,35 @@ package resources import ( + "context" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMPolicyResource = "IAMPolicy" + +func init() { + resource.Register(resource.Registration{ + Name: IAMPolicyResource, + Scope: nuke.Account, + Lister: &IAMPolicyLister{}, + DependsOn: []string{ + IAMUserPolicyAttachmentResource, + IAMGroupPolicyAttachmentResource, + IAMRolePolicyAttachmentResource, + }, + }) +} + type IAMPolicy struct { svc iamiface.IAMAPI name string @@ -18,10 +39,54 @@ type IAMPolicy struct { tags []*iam.Tag } -func init() { - register("IAMPolicy", ListIAMPolicies) +func (e *IAMPolicy) Remove(_ context.Context) error { + resp, err := e.svc.ListPolicyVersions(&iam.ListPolicyVersionsInput{ + PolicyArn: &e.arn, + }) + if err != nil { + return err + } + for _, version := range resp.Versions { + if !*version.IsDefaultVersion { + _, err = e.svc.DeletePolicyVersion(&iam.DeletePolicyVersionInput{ + PolicyArn: &e.arn, + VersionId: version.VersionId, + }) + if err != nil { + return err + } + + } + } + _, err = e.svc.DeletePolicy(&iam.DeletePolicyInput{ + PolicyArn: &e.arn, + }) + if err != nil { + return err + } + + return nil } +func (e *IAMPolicy) Properties() types.Properties { + properties := types.NewProperties() + + properties.Set("Name", e.name) + properties.Set("ARN", e.arn) + properties.Set("Path", e.path) + properties.Set("PolicyID", e.policyId) + for _, tag := range e.tags { + properties.SetTag(tag.Key, tag.Value) + } + return properties +} + +func (e *IAMPolicy) String() string { + return e.arn +} + +// ------------- + func GetIAMPolicy(svc *iam.IAM, policyArn *string) (*iam.Policy, error) { params := &iam.GetPolicyInput{ PolicyArn: policyArn, @@ -30,8 +95,12 @@ func GetIAMPolicy(svc *iam.IAM, policyArn *string) (*iam.Policy, error) { return resp.Policy, err } -func ListIAMPolicies(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMPolicyLister struct{} + +func (l *IAMPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) params := &iam.ListPoliciesInput{ Scope: aws.String("Local"), @@ -39,7 +108,7 @@ func ListIAMPolicies(sess *session.Session) ([]Resource, error) { policies := make([]*iam.Policy, 0) - err := svc.ListPoliciesPages(params, + if err := svc.ListPoliciesPages(params, func(page *iam.ListPoliciesOutput, lastPage bool) bool { for _, listedPolicy := range page.Policies { policy, err := GetIAMPolicy(svc, listedPolicy.Arn) @@ -50,12 +119,11 @@ func ListIAMPolicies(sess *session.Session) ([]Resource, error) { policies = append(policies, policy) } return true - }) - if err != nil { + }); err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range policies { resources = append(resources, &IAMPolicy{ @@ -70,49 +138,3 @@ func ListIAMPolicies(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMPolicy) Remove() error { - resp, err := e.svc.ListPolicyVersions(&iam.ListPolicyVersionsInput{ - PolicyArn: &e.arn, - }) - if err != nil { - return err - } - for _, version := range resp.Versions { - if !*version.IsDefaultVersion { - _, err = e.svc.DeletePolicyVersion(&iam.DeletePolicyVersionInput{ - PolicyArn: &e.arn, - VersionId: version.VersionId, - }) - if err != nil { - return err - } - - } - } - _, err = e.svc.DeletePolicy(&iam.DeletePolicyInput{ - PolicyArn: &e.arn, - }) - if err != nil { - return err - } - - return nil -} - -func (policy *IAMPolicy) Properties() types.Properties { - properties := types.NewProperties() - - properties.Set("Name", policy.name) - properties.Set("ARN", policy.arn) - properties.Set("Path", policy.path) - properties.Set("PolicyID", policy.policyId) - for _, tag := range policy.tags { - properties.SetTag(tag.Key, tag.Value) - } - return properties -} - -func (e *IAMPolicy) String() string { - return e.arn -} diff --git a/resources/iam-policies_mock_test.go b/resources/iam-policies_mock_test.go index d360371bf..dee908b52 100644 --- a/resources/iam-policies_mock_test.go +++ b/resources/iam-policies_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMPolicy_Remove(t *testing.T) { @@ -39,7 +42,7 @@ func Test_Mock_IAMPolicy_Remove(t *testing.T) { PolicyArn: aws.String(iamPolicy.arn), })).Return(&iam.DeletePolicyOutput{}, nil) - err := iamPolicy.Remove() + err := iamPolicy.Remove(context.TODO()) a.Nil(err) } @@ -90,6 +93,6 @@ func Test_Mock_IAMPolicy_WithVersions_Remove(t *testing.T) { PolicyArn: aws.String(iamPolicy.arn), })).Return(&iam.DeletePolicyOutput{}, nil) - err := iamPolicy.Remove() + err := iamPolicy.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-role-policy-attachments.go b/resources/iam-role-policy-attachments.go index dfaae37aa..bce2010fb 100644 --- a/resources/iam-role-policy-attachments.go +++ b/resources/iam-role-policy-attachments.go @@ -1,17 +1,33 @@ package resources import ( + "context" + "fmt" "strings" "time" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMRolePolicyAttachmentResource = "IAMRolePolicyAttachment" + +func init() { + resource.Register(resource.Registration{ + Name: IAMRolePolicyAttachmentResource, + Scope: nuke.Account, + Lister: &IAMRolePolicyAttachmentLister{}, + }) +} + type IAMRolePolicyAttachment struct { svc iamiface.IAMAPI policyArn string @@ -19,14 +35,58 @@ type IAMRolePolicyAttachment struct { role *iam.Role } -func init() { - register("IAMRolePolicyAttachment", ListIAMRolePolicyAttachments) +func (e *IAMRolePolicyAttachment) Filter() error { + if strings.Contains(e.policyArn, ":iam::aws:policy/aws-service-role/") { + return fmt.Errorf("cannot detach from service roles") + } + if strings.HasPrefix(*e.role.Path, "/aws-reserved/sso.amazonaws.com/") { + return fmt.Errorf("cannot detach from SSO roles") + } + return nil +} + +func (e *IAMRolePolicyAttachment) Remove(_ context.Context) error { + _, err := e.svc.DetachRolePolicy( + &iam.DetachRolePolicyInput{ + PolicyArn: &e.policyArn, + RoleName: e.role.RoleName, + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMRolePolicyAttachment) Properties() types.Properties { + properties := types.NewProperties(). + Set("RoleName", e.role.RoleName). + Set("RolePath", e.role.Path). + Set("RoleLastUsed", getLastUsedDate(e.role, time.RFC3339)). + Set("RoleCreateDate", e.role.CreateDate.Format(time.RFC3339)). + Set("PolicyName", e.policyName). + Set("PolicyArn", e.policyArn) + + for _, tag := range e.role.Tags { + properties.SetTagWithPrefix("role", tag.Key, tag.Value) + } + return properties +} + +func (e *IAMRolePolicyAttachment) String() string { + return fmt.Sprintf("%s -> %s", *e.role.RoleName, e.policyName) } -func ListIAMRolePolicyAttachments(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +// ----------------------- + +type IAMRolePolicyAttachmentLister struct{} + +func (l *IAMRolePolicyAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) roleParams := &iam.ListRolesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { roleResp, err := svc.ListRoles(roleParams) @@ -78,45 +138,3 @@ func ListIAMRolePolicyAttachments(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMRolePolicyAttachment) Filter() error { - if strings.Contains(e.policyArn, ":iam::aws:policy/aws-service-role/") { - return fmt.Errorf("cannot detach from service roles") - } - if strings.HasPrefix(*e.role.Path, "/aws-reserved/sso.amazonaws.com/") { - return fmt.Errorf("cannot detach from SSO roles") - } - return nil -} - -func (e *IAMRolePolicyAttachment) Remove() error { - _, err := e.svc.DetachRolePolicy( - &iam.DetachRolePolicyInput{ - PolicyArn: &e.policyArn, - RoleName: e.role.RoleName, - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMRolePolicyAttachment) Properties() types.Properties { - properties := types.NewProperties(). - Set("RoleName", e.role.RoleName). - Set("RolePath", e.role.Path). - Set("RoleLastUsed", getLastUsedDate(e.role, time.RFC3339)). - Set("RoleCreateDate", e.role.CreateDate.Format(time.RFC3339)). - Set("PolicyName", e.policyName). - Set("PolicyArn", e.policyArn) - - for _, tag := range e.role.Tags { - properties.SetTagWithPrefix("role", tag.Key, tag.Value) - } - return properties -} - -func (e *IAMRolePolicyAttachment) String() string { - return fmt.Sprintf("%s -> %s", *e.role.RoleName, e.policyName) -} diff --git a/resources/iam-role-policy-attachments_mock_test.go b/resources/iam-role-policy-attachments_mock_test.go index 181d0488e..ecba6f425 100644 --- a/resources/iam-role-policy-attachments_mock_test.go +++ b/resources/iam-role-policy-attachments_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMRolePolicyAttachment_Remove(t *testing.T) { @@ -31,6 +34,6 @@ func Test_Mock_IAMRolePolicyAttachment_Remove(t *testing.T) { PolicyArn: aws.String(iamRolePolicyAttachment.policyArn), })).Return(&iam.DetachRolePolicyOutput{}, nil) - err := iamRolePolicyAttachment.Remove() + err := iamRolePolicyAttachment.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-role-policy.go b/resources/iam-role-policy.go index 047f4794b..8dab78ad1 100644 --- a/resources/iam-role-policy.go +++ b/resources/iam-role-policy.go @@ -1,17 +1,32 @@ package resources import ( + "context" + "fmt" "strings" "github.com/sirupsen/logrus" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMRolePolicyResource = "IAMRolePolicy" + +func init() { + resource.Register(resource.Registration{ + Name: IAMRolePolicyResource, + Scope: nuke.Account, + Lister: &IAMRolePolicyLister{}, + }) +} + type IAMRolePolicy struct { svc iamiface.IAMAPI roleId string @@ -21,14 +36,53 @@ type IAMRolePolicy struct { roleTags []*iam.Tag } -func init() { - register("IAMRolePolicy", ListIAMRolePolicies) +func (e *IAMRolePolicy) Filter() error { + if strings.HasPrefix(e.rolePath, "/aws-service-role/") { + return fmt.Errorf("cannot alter service roles") + } + return nil } -func ListIAMRolePolicies(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +func (e *IAMRolePolicy) Remove(_ context.Context) error { + _, err := e.svc.DeleteRolePolicy( + &iam.DeleteRolePolicyInput{ + RoleName: &e.roleName, + PolicyName: &e.policyName, + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMRolePolicy) Properties() types.Properties { + properties := types.NewProperties() + properties.Set("PolicyName", e.policyName) + properties.Set("role:RoleName", e.roleName) + properties.Set("role:RoleID", e.roleId) + properties.Set("role:Path", e.rolePath) + + for _, tagValue := range e.roleTags { + properties.SetTagWithPrefix("role", tagValue.Key, tagValue.Value) + } + return properties +} + +func (e *IAMRolePolicy) String() string { + return fmt.Sprintf("%s -> %s", e.roleName, e.policyName) +} + +// ---------------------- + +type IAMRolePolicyLister struct{} + +func (l *IAMRolePolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) roleParams := &iam.ListRolesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { roles, err := svc.ListRoles(roleParams) @@ -85,40 +139,3 @@ func ListIAMRolePolicies(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMRolePolicy) Filter() error { - if strings.HasPrefix(e.rolePath, "/aws-service-role/") { - return fmt.Errorf("cannot alter service roles") - } - return nil -} - -func (e *IAMRolePolicy) Remove() error { - _, err := e.svc.DeleteRolePolicy( - &iam.DeleteRolePolicyInput{ - RoleName: &e.roleName, - PolicyName: &e.policyName, - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMRolePolicy) Properties() types.Properties { - properties := types.NewProperties() - properties.Set("PolicyName", e.policyName) - properties.Set("role:RoleName", e.roleName) - properties.Set("role:RoleID", e.roleId) - properties.Set("role:Path", e.rolePath) - - for _, tagValue := range e.roleTags { - properties.SetTagWithPrefix("role", tagValue.Key, tagValue.Value) - } - return properties -} - -func (e *IAMRolePolicy) String() string { - return fmt.Sprintf("%s -> %s", e.roleName, e.policyName) -} diff --git a/resources/iam-role-policy_mock_test.go b/resources/iam-role-policy_mock_test.go index 8f604cb39..d0c55d89f 100644 --- a/resources/iam-role-policy_mock_test.go +++ b/resources/iam-role-policy_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMRolePolicy_Remove(t *testing.T) { @@ -30,6 +33,6 @@ func Test_Mock_IAMRolePolicy_Remove(t *testing.T) { PolicyName: aws.String(iamRolePolicy.policyName), })).Return(&iam.DeleteRolePolicyOutput{}, nil) - err := iamRolePolicy.Remove() + err := iamRolePolicy.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-roles.go b/resources/iam-roles.go index c2c4dcebd..92d9e94a4 100644 --- a/resources/iam-roles.go +++ b/resources/iam-roles.go @@ -1,18 +1,37 @@ package resources import ( + "context" + "fmt" "strings" "time" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMRoleResource = "IAMRole" + +func init() { + resource.Register(resource.Registration{ + Name: IAMRoleResource, + Scope: nuke.Account, + Lister: &IAMRoleLister{}, + DependsOn: []string{ + IAMRolePolicyAttachmentResource, + }, + }) +} + type IAMRole struct { svc iamiface.IAMAPI name string @@ -20,10 +39,42 @@ type IAMRole struct { tags []*iam.Tag } -func init() { - register("IAMRole", ListIAMRoles) +func (e *IAMRole) Filter() error { + if strings.HasPrefix(e.path, "/aws-service-role/") { + return fmt.Errorf("cannot delete service roles") + } + if strings.HasPrefix(e.path, "/aws-reserved/sso.amazonaws.com/") { + return fmt.Errorf("cannot delete SSO roles") + } + return nil } +func (e *IAMRole) Remove(_ context.Context) error { + _, err := e.svc.DeleteRole(&iam.DeleteRoleInput{ + RoleName: aws.String(e.name), + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMRole) Properties() types.Properties { + properties := types.NewProperties() + for _, tagValue := range e.tags { + properties.SetTag(tagValue.Key, tagValue.Value) + } + + return properties +} + +func (e *IAMRole) String() string { + return e.name +} + +// --------- + func GetIAMRole(svc *iam.IAM, roleName *string) (*iam.Role, error) { params := &iam.GetRoleInput{ RoleName: roleName, @@ -32,10 +83,27 @@ func GetIAMRole(svc *iam.IAM, roleName *string) (*iam.Role, error) { return resp.Role, err } -func ListIAMRoles(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +func getLastUsedDate(role *iam.Role, format string) string { + var lastUsedDate *time.Time + if role.RoleLastUsed == nil || role.RoleLastUsed.LastUsedDate == nil { + lastUsedDate = role.CreateDate + } else { + lastUsedDate = role.RoleLastUsed.LastUsedDate + } + + return lastUsedDate.Format(format) +} + +// -------------- + +type IAMRoleLister struct{} + +func (l *IAMRoleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) params := &iam.ListRolesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListRoles(params) @@ -70,48 +138,3 @@ func ListIAMRoles(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMRole) Filter() error { - if strings.HasPrefix(e.path, "/aws-service-role/") { - return fmt.Errorf("cannot delete service roles") - } - if strings.HasPrefix(e.path, "/aws-reserved/sso.amazonaws.com/") { - return fmt.Errorf("cannot delete SSO roles") - } - return nil -} - -func (e *IAMRole) Remove() error { - _, err := e.svc.DeleteRole(&iam.DeleteRoleInput{ - RoleName: aws.String(e.name), - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMRole) Properties() types.Properties { - properties := types.NewProperties() - for _, tagValue := range e.tags { - properties.SetTag(tagValue.Key, tagValue.Value) - } - - return properties -} - -func (e *IAMRole) String() string { - return e.name -} - -func getLastUsedDate(role *iam.Role, format string) string { - var lastUsedDate *time.Time - if role.RoleLastUsed == nil || role.RoleLastUsed.LastUsedDate == nil { - lastUsedDate = role.CreateDate - } else { - lastUsedDate = role.RoleLastUsed.LastUsedDate - } - - return lastUsedDate.Format(format) -} diff --git a/resources/iam-roles_mock_test.go b/resources/iam-roles_mock_test.go index 610f6df88..9a69e647b 100644 --- a/resources/iam-roles_mock_test.go +++ b/resources/iam-roles_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMRole_Remove(t *testing.T) { @@ -28,6 +31,6 @@ func Test_Mock_IAMRole_Remove(t *testing.T) { RoleName: aws.String(iamRole.name), })).Return(&iam.DeleteRoleOutput{}, nil) - err := iamRole.Remove() + err := iamRole.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-saml-provider.go b/resources/iam-saml-provider.go index 14944e3a8..e3d3ae621 100644 --- a/resources/iam-saml-provider.go +++ b/resources/iam-saml-provider.go @@ -1,24 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) -type IAMSAMLProvider struct { - svc iamiface.IAMAPI - arn string -} +const IAMSAMLProviderResource = "IAMSAMLProvider" func init() { - register("IAMSAMLProvider", ListIAMSAMLProvider) + resource.Register(resource.Registration{ + Name: IAMSAMLProviderResource, + Scope: nuke.Account, + Lister: &IAMSAMLProviderLister{}, + }) } -func ListIAMSAMLProvider(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMSAMLProviderLister struct{} + +func (l *IAMSAMLProviderLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) params := &iam.ListSAMLProvidersInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) resp, err := svc.ListSAMLProviders(params) if err != nil { @@ -35,7 +43,12 @@ func ListIAMSAMLProvider(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMSAMLProvider) Remove() error { +type IAMSAMLProvider struct { + svc iamiface.IAMAPI + arn string +} + +func (e *IAMSAMLProvider) Remove(_ context.Context) error { _, err := e.svc.DeleteSAMLProvider(&iam.DeleteSAMLProviderInput{ SAMLProviderArn: &e.arn, }) diff --git a/resources/iam-saml-provider_mock_test.go b/resources/iam-saml-provider_mock_test.go index 21cccdd58..f4853c3eb 100644 --- a/resources/iam-saml-provider_mock_test.go +++ b/resources/iam-saml-provider_mock_test.go @@ -1,12 +1,15 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMSAMLProvider_Remove(t *testing.T) { @@ -25,6 +28,6 @@ func Test_Mock_IAMSAMLProvider_Remove(t *testing.T) { SAMLProviderArn: &iamSAMLProvider.arn, })).Return(&iam.DeleteSAMLProviderOutput{}, nil) - err := iamSAMLProvider.Remove() + err := iamSAMLProvider.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-server-certificate.go b/resources/iam-server-certificate.go index 9206f2a2b..4889197c7 100644 --- a/resources/iam-server-certificate.go +++ b/resources/iam-server-certificate.go @@ -1,29 +1,39 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMServerCertificate struct { - svc iamiface.IAMAPI - name string -} +const IAMServerCertificateResource = "IAMServerCertificate" func init() { - register("IAMServerCertificate", ListIAMServerCertificates) + resource.Register(resource.Registration{ + Name: IAMServerCertificateResource, + Scope: nuke.Account, + Lister: &IAMServerCertificateLister{}, + }) } -func ListIAMServerCertificates(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMServerCertificateLister struct{} + +func (l *IAMServerCertificateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) resp, err := svc.ListServerCertificates(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, meta := range resp.ServerCertificateMetadataList { resources = append(resources, &IAMServerCertificate{ svc: svc, @@ -34,7 +44,12 @@ func ListIAMServerCertificates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMServerCertificate) Remove() error { +type IAMServerCertificate struct { + svc iamiface.IAMAPI + name string +} + +func (e *IAMServerCertificate) Remove(_ context.Context) error { _, err := e.svc.DeleteServerCertificate(&iam.DeleteServerCertificateInput{ ServerCertificateName: &e.name, }) diff --git a/resources/iam-server-certificate_mock_test.go b/resources/iam-server-certificate_mock_test.go index 452a69896..ae35a6cb7 100644 --- a/resources/iam-server-certificate_mock_test.go +++ b/resources/iam-server-certificate_mock_test.go @@ -1,12 +1,15 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMServerCertificate_Remove(t *testing.T) { @@ -25,6 +28,6 @@ func Test_Mock_IAMServerCertificate_Remove(t *testing.T) { ServerCertificateName: &iamServerCertificate.name, })).Return(&iam.DeleteServerCertificateOutput{}, nil) - err := iamServerCertificate.Remove() + err := iamServerCertificate.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-service-specific-credentials.go b/resources/iam-service-specific-credentials.go index 14b52f299..28eeddb6f 100644 --- a/resources/iam-service-specific-credentials.go +++ b/resources/iam-service-specific-credentials.go @@ -1,34 +1,43 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMServiceSpecificCredential struct { - svc iamiface.IAMAPI - name string - serviceName string - id string - userName string -} +const IAMServiceSpecificCredentialResource = "IAMServiceSpecificCredential" func init() { - register("IAMServiceSpecificCredential", ListServiceSpecificCredentials) + resource.Register(resource.Registration{ + Name: IAMServiceSpecificCredentialResource, + Scope: nuke.Account, + Lister: &IAMServiceSpecificCredentialLister{}, + }) } -func ListServiceSpecificCredentials(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMServiceSpecificCredentialLister struct{} + +func (l *IAMServiceSpecificCredentialLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) - users, usersErr := ListIAMUsers(sess) + userLister := &IAMUsersLister{} + users, usersErr := userLister.List(ctx, o) if usersErr != nil { return nil, usersErr } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, userResource := range users { user, ok := userResource.(*IAMUser) if !ok { @@ -57,7 +66,15 @@ func ListServiceSpecificCredentials(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *IAMServiceSpecificCredential) Remove() error { +type IAMServiceSpecificCredential struct { + svc iamiface.IAMAPI + name string + serviceName string + id string + userName string +} + +func (e *IAMServiceSpecificCredential) Remove(_ context.Context) error { params := &iam.DeleteServiceSpecificCredentialInput{ ServiceSpecificCredentialId: &e.id, UserName: &e.userName, diff --git a/resources/iam-service-specific-credentials_mock_test.go b/resources/iam-service-specific-credentials_mock_test.go index 3b6415cc9..83276c849 100644 --- a/resources/iam-service-specific-credentials_mock_test.go +++ b/resources/iam-service-specific-credentials_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMServiceSpecificCredential_Remove(t *testing.T) { @@ -30,6 +33,6 @@ func Test_Mock_IAMServiceSpecificCredential_Remove(t *testing.T) { ServiceSpecificCredentialId: aws.String(iamServiceSpecificCredential.id), })).Return(&iam.DeleteServiceSpecificCredentialOutput{}, nil) - err := iamServiceSpecificCredential.Remove() + err := iamServiceSpecificCredential.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-signing-certificates.go b/resources/iam-signing-certificate.go similarity index 64% rename from resources/iam-signing-certificates.go rename to resources/iam-signing-certificate.go index 72b957b72..750fe58a8 100644 --- a/resources/iam-signing-certificates.go +++ b/resources/iam-signing-certificate.go @@ -1,29 +1,39 @@ package resources import ( + "context" + "fmt" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMSigningCertificate struct { - svc iamiface.IAMAPI - certificateId *string - userName *string - status *string -} +const IAMSigningCertificateResource = "IAMSigningCertificate" func init() { - register("IAMSigningCertificate", ListIAMSigningCertificates) + resource.Register(resource.Registration{ + Name: IAMSigningCertificateResource, + Scope: nuke.Account, + Lister: &IAMSigningCertificateLister{}, + }) } -func ListIAMSigningCertificates(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) - resources := []Resource{} +type IAMSigningCertificateLister struct{} + +func (l *IAMSigningCertificateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) + var resources []resource.Resource params := &iam.ListUsersInput{ MaxItems: aws.Int64(100), @@ -63,7 +73,14 @@ func ListIAMSigningCertificates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *IAMSigningCertificate) Remove() error { +type IAMSigningCertificate struct { + svc iamiface.IAMAPI + certificateId *string + userName *string + status *string +} + +func (i *IAMSigningCertificate) Remove(_ context.Context) error { _, err := i.svc.DeleteSigningCertificate(&iam.DeleteSigningCertificateInput{ CertificateId: i.certificateId, UserName: i.userName, @@ -79,5 +96,5 @@ func (i *IAMSigningCertificate) Properties() types.Properties { } func (i *IAMSigningCertificate) String() string { - return fmt.Sprintf("%s -> %s", *i.userName, *i.certificateId) + return fmt.Sprintf("%s -> %s", ptr.ToString(i.userName), ptr.ToString(i.certificateId)) } diff --git a/resources/iam-signing-certificate_mock_test.go b/resources/iam-signing-certificate_mock_test.go index 0d0672be0..d5c7595a8 100644 --- a/resources/iam-signing-certificate_mock_test.go +++ b/resources/iam-signing-certificate_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMSigningCertificate_Remove(t *testing.T) { @@ -29,6 +32,6 @@ func Test_Mock_IAMSigningCertificate_Remove(t *testing.T) { CertificateId: iamSigningCertificate.certificateId, })).Return(&iam.DeleteSigningCertificateOutput{}, nil) - err := iamSigningCertificate.Remove() + err := iamSigningCertificate.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-user-access-keys.go b/resources/iam-user-access-key.go similarity index 69% rename from resources/iam-user-access-keys.go rename to resources/iam-user-access-key.go index daf302901..95fe2ccab 100644 --- a/resources/iam-user-access-keys.go +++ b/resources/iam-user-access-key.go @@ -1,14 +1,29 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMUserAccessKeyResource = "IAMUserAccessKey" + +func init() { + resource.Register(resource.Registration{ + Name: IAMUserAccessKeyResource, + Scope: nuke.Account, + Lister: &IAMUserAccessKeyLister{}, + }) +} + type IAMUserAccessKey struct { svc iamiface.IAMAPI accessKeyId string @@ -17,19 +32,49 @@ type IAMUserAccessKey struct { userTags []*iam.Tag } -func init() { - register("IAMUserAccessKey", ListIAMUserAccessKeys) +func (e *IAMUserAccessKey) Remove(_ context.Context) error { + _, err := e.svc.DeleteAccessKey( + &iam.DeleteAccessKeyInput{ + AccessKeyId: &e.accessKeyId, + UserName: &e.userName, + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMUserAccessKey) Properties() types.Properties { + properties := types.NewProperties() + properties.Set("UserName", e.userName) + properties.Set("AccessKeyID", e.accessKeyId) + + for _, tag := range e.userTags { + properties.SetTag(tag.Key, tag.Value) + } + + return properties +} + +func (e *IAMUserAccessKey) String() string { + return fmt.Sprintf("%s -> %s", e.userName, e.accessKeyId) } -func ListIAMUserAccessKeys(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +// -------------- + +type IAMUserAccessKeyLister struct{} + +func (l *IAMUserAccessKeyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := iam.New(opts.Session) resp, err := svc.ListUsers(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, role := range resp.Users { resp, err := svc.ListAccessKeys( &iam.ListAccessKeysInput{ @@ -57,32 +102,3 @@ func ListIAMUserAccessKeys(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMUserAccessKey) Remove() error { - _, err := e.svc.DeleteAccessKey( - &iam.DeleteAccessKeyInput{ - AccessKeyId: &e.accessKeyId, - UserName: &e.userName, - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMUserAccessKey) Properties() types.Properties { - properties := types.NewProperties() - properties.Set("UserName", e.userName) - properties.Set("AccessKeyID", e.accessKeyId) - - for _, tag := range e.userTags { - properties.SetTag(tag.Key, tag.Value) - } - - return properties -} - -func (e *IAMUserAccessKey) String() string { - return fmt.Sprintf("%s -> %s", e.userName, e.accessKeyId) -} diff --git a/resources/iam-user-access-key_mock_test.go b/resources/iam-user-access-key_mock_test.go index f6938bc11..659e01d52 100644 --- a/resources/iam-user-access-key_mock_test.go +++ b/resources/iam-user-access-key_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMUserAccessKey_Remove(t *testing.T) { @@ -29,6 +32,6 @@ func Test_Mock_IAMUserAccessKey_Remove(t *testing.T) { UserName: aws.String(iamUserAccessKey.userName), })).Return(&iam.DeleteAccessKeyOutput{}, nil) - err := iamUserAccessKey.Remove() + err := iamUserAccessKey.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-user-group-attachments.go b/resources/iam-user-group-attachments.go index 10cabc63f..5dca70e8c 100644 --- a/resources/iam-user-group-attachments.go +++ b/resources/iam-user-group-attachments.go @@ -1,33 +1,72 @@ package resources import ( + "context" + "fmt" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMUserGroupAttachmentResource = "IAMUserGroupAttachment" + +func init() { + resource.Register(resource.Registration{ + Name: IAMUserGroupAttachmentResource, + Scope: nuke.Account, + Lister: &IAMUserGroupAttachmentLister{}, + }) +} + type IAMUserGroupAttachment struct { svc iamiface.IAMAPI groupName string userName string } -func init() { - register("IAMUserGroupAttachment", ListIAMUserGroupAttachments) +func (e *IAMUserGroupAttachment) Remove(_ context.Context) error { + _, err := e.svc.RemoveUserFromGroup( + &iam.RemoveUserFromGroupInput{ + GroupName: &e.groupName, + UserName: &e.userName, + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMUserGroupAttachment) String() string { + return fmt.Sprintf("%s -> %s", e.userName, e.groupName) +} + +func (e *IAMUserGroupAttachment) Properties() types.Properties { + return types.NewProperties(). + Set("GroupName", e.groupName). + Set("UserName", e.userName) } -func ListIAMUserGroupAttachments(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +// ------------------------------ + +type IAMUserGroupAttachmentLister struct{} + +func (l *IAMUserGroupAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := iam.New(opts.Session) resp, err := svc.ListUsers(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, role := range resp.Users { resp, err := svc.ListGroupsForUser( &iam.ListGroupsForUserInput{ @@ -48,26 +87,3 @@ func ListIAMUserGroupAttachments(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMUserGroupAttachment) Remove() error { - _, err := e.svc.RemoveUserFromGroup( - &iam.RemoveUserFromGroupInput{ - GroupName: &e.groupName, - UserName: &e.userName, - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMUserGroupAttachment) String() string { - return fmt.Sprintf("%s -> %s", e.userName, e.groupName) -} - -func (e *IAMUserGroupAttachment) Properties() types.Properties { - return types.NewProperties(). - Set("GroupName", e.groupName). - Set("UserName", e.userName) -} diff --git a/resources/iam-user-group-attachments_mock_test.go b/resources/iam-user-group-attachments_mock_test.go index 24d71d0de..06e7d592b 100644 --- a/resources/iam-user-group-attachments_mock_test.go +++ b/resources/iam-user-group-attachments_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMUserGroup_Remove(t *testing.T) { @@ -28,6 +31,6 @@ func Test_Mock_IAMUserGroup_Remove(t *testing.T) { GroupName: aws.String(iamUserGroup.groupName), })).Return(&iam.RemoveUserFromGroupOutput{}, nil) - err := iamUserGroup.Remove() + err := iamUserGroup.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-user-https-git-credential.go b/resources/iam-user-https-git-credential.go new file mode 100644 index 000000000..86299dd59 --- /dev/null +++ b/resources/iam-user-https-git-credential.go @@ -0,0 +1,106 @@ +package resources + +import ( + "context" + + "fmt" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +const IAMUserHTTPSGitCredentialResource = "IAMUserHTTPSGitCredential" + +func init() { + resource.Register(resource.Registration{ + Name: IAMUserHTTPSGitCredentialResource, + Scope: nuke.Account, + Lister: &IAMUserHTTPSGitCredentialLister{}, + }) +} + +type IAMUserHTTPSGitCredential struct { + svc iamiface.IAMAPI + id string + userName string + status string + userTags []*iam.Tag +} + +func (e *IAMUserHTTPSGitCredential) Remove(_ context.Context) error { + _, err := e.svc.DeleteServiceSpecificCredential( + &iam.DeleteServiceSpecificCredentialInput{ + UserName: &e.userName, + ServiceSpecificCredentialId: &e.id, + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMUserHTTPSGitCredential) Properties() types.Properties { + properties := types.NewProperties() + properties.Set("UserName", e.userName) + properties.Set("ServiceSpecificCredentialId", e.id) + + for _, tag := range e.userTags { + properties.SetTag(tag.Key, tag.Value) + } + + return properties +} + +func (e *IAMUserHTTPSGitCredential) String() string { + return fmt.Sprintf("%s -> %s", e.userName, e.id) +} + +// -------------- + +type IAMUserHTTPSGitCredentialLister struct{} + +func (l *IAMUserHTTPSGitCredentialLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) + resp, err := svc.ListUsers(nil) + if err != nil { + return nil, err + } + + resources := make([]resource.Resource, 0) + for _, role := range resp.Users { + resp, err := svc.ListServiceSpecificCredentials( + &iam.ListServiceSpecificCredentialsInput{ + UserName: role.UserName, + ServiceName: aws.String("codecommit.amazonaws.com"), + }) + if err != nil { + return nil, err + } + + userTags, err := svc.ListUserTags(&iam.ListUserTagsInput{UserName: role.UserName}) + if err != nil { + return nil, err + } + + for _, meta := range resp.ServiceSpecificCredentials { + resources = append(resources, &IAMUserHTTPSGitCredential{ + svc: svc, + id: *meta.ServiceSpecificCredentialId, + userName: *meta.UserName, + status: *meta.Status, + userTags: userTags.Tags, + }) + } + } + + return resources, nil +} diff --git a/resources/iam-user-policy-attachments.go b/resources/iam-user-policy-attachment.go similarity index 69% rename from resources/iam-user-policy-attachments.go rename to resources/iam-user-policy-attachment.go index ad0528d04..e3ed0d0e9 100644 --- a/resources/iam-user-policy-attachments.go +++ b/resources/iam-user-policy-attachment.go @@ -1,15 +1,31 @@ package resources import ( + "context" + "fmt" + "github.com/sirupsen/logrus" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMUserPolicyAttachmentResource = "IAMUserPolicyAttachment" + +func init() { + resource.Register(resource.Registration{ + Name: IAMUserPolicyAttachmentResource, + Scope: nuke.Account, + Lister: &IAMUserPolicyAttachmentLister{}, + }) +} + type IAMUserPolicyAttachment struct { svc iamiface.IAMAPI policyArn string @@ -18,19 +34,49 @@ type IAMUserPolicyAttachment struct { userTags []*iam.Tag } -func init() { - register("IAMUserPolicyAttachment", ListIAMUserPolicyAttachments) +func (e *IAMUserPolicyAttachment) Remove(_ context.Context) error { + _, err := e.svc.DetachUserPolicy( + &iam.DetachUserPolicyInput{ + PolicyArn: &e.policyArn, + UserName: &e.userName, + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMUserPolicyAttachment) Properties() types.Properties { + properties := types.NewProperties(). + Set("PolicyArn", e.policyArn). + Set("PolicyName", e.policyName). + Set("UserName", e.userName) + for _, tag := range e.userTags { + properties.SetTagWithPrefix("user", tag.Key, tag.Value) + } + return properties +} + +func (e *IAMUserPolicyAttachment) String() string { + return fmt.Sprintf("%s -> %s", e.userName, e.policyName) } -func ListIAMUserPolicyAttachments(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +// ------------------------------- + +type IAMUserPolicyAttachmentLister struct{} + +func (l *IAMUserPolicyAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) resp, err := svc.ListUsers(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, user := range resp.Users { iamUser, err := GetIAMUser(svc, user.UserName) if err != nil { @@ -59,31 +105,3 @@ func ListIAMUserPolicyAttachments(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMUserPolicyAttachment) Remove() error { - _, err := e.svc.DetachUserPolicy( - &iam.DetachUserPolicyInput{ - PolicyArn: &e.policyArn, - UserName: &e.userName, - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMUserPolicyAttachment) Properties() types.Properties { - properties := types.NewProperties(). - Set("PolicyArn", e.policyArn). - Set("PolicyName", e.policyName). - Set("UserName", e.userName) - for _, tag := range e.userTags { - properties.SetTagWithPrefix("user", tag.Key, tag.Value) - } - return properties -} - -func (e *IAMUserPolicyAttachment) String() string { - return fmt.Sprintf("%s -> %s", e.userName, e.policyName) -} diff --git a/resources/iam-user-policy-attachment_mock_test.go b/resources/iam-user-policy-attachment_mock_test.go index 946cda333..c40140054 100644 --- a/resources/iam-user-policy-attachment_mock_test.go +++ b/resources/iam-user-policy-attachment_mock_test.go @@ -1,13 +1,17 @@ package resources import ( + "context" + "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMUserPolicyAttachment_Remove(t *testing.T) { @@ -29,6 +33,6 @@ func Test_Mock_IAMUserPolicyAttachment_Remove(t *testing.T) { PolicyArn: aws.String(iamUserPolicyAttachment.policyArn), })).Return(&iam.DetachUserPolicyOutput{}, nil) - err := iamUserPolicyAttachment.Remove() + err := iamUserPolicyAttachment.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-user-policy.go b/resources/iam-user-policy.go index a2b2f43cf..c1748b27d 100644 --- a/resources/iam-user-policy.go +++ b/resources/iam-user-policy.go @@ -1,32 +1,66 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMUserPolicyResource = "IAMUserPolicy" + +func init() { + resource.Register(resource.Registration{ + Name: IAMUserPolicyResource, + Scope: nuke.Account, + Lister: &IAMUserPolicyLister{}, + }) +} + type IAMUserPolicy struct { svc iamiface.IAMAPI userName string policyName string } -func init() { - register("IAMUserPolicy", ListIAMUserPolicies) +func (e *IAMUserPolicy) Remove(_ context.Context) error { + _, err := e.svc.DeleteUserPolicy( + &iam.DeleteUserPolicyInput{ + UserName: &e.userName, + PolicyName: &e.policyName, + }) + if err != nil { + return err + } + + return nil } -func ListIAMUserPolicies(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +func (e *IAMUserPolicy) String() string { + return fmt.Sprintf("%s -> %s", e.userName, e.policyName) +} + +// ---------------- + +type IAMUserPolicyLister struct{} + +func (l *IAMUserPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) users, err := svc.ListUsers(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, user := range users.Users { policies, err := svc.ListUserPolicies(&iam.ListUserPoliciesInput{ UserName: user.UserName, @@ -46,20 +80,3 @@ func ListIAMUserPolicies(sess *session.Session) ([]Resource, error) { return resources, nil } - -func (e *IAMUserPolicy) Remove() error { - _, err := e.svc.DeleteUserPolicy( - &iam.DeleteUserPolicyInput{ - UserName: &e.userName, - PolicyName: &e.policyName, - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMUserPolicy) String() string { - return fmt.Sprintf("%s -> %s", e.userName, e.policyName) -} diff --git a/resources/iam-user-policy_mock_test.go b/resources/iam-user-policy_mock_test.go index 6a77afa63..302ebbe31 100644 --- a/resources/iam-user-policy_mock_test.go +++ b/resources/iam-user-policy_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMUserPolicy_Remove(t *testing.T) { @@ -28,6 +31,6 @@ func Test_Mock_IAMUserPolicy_Remove(t *testing.T) { PolicyName: aws.String(iamUserPolicy.policyName), })).Return(&iam.DeleteUserPolicyOutput{}, nil) - err := iamUserPolicy.Remove() + err := iamUserPolicy.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-user-ssh-keys.go b/resources/iam-user-ssh-keys.go index 2327d5076..b78242e77 100644 --- a/resources/iam-user-ssh-keys.go +++ b/resources/iam-user-ssh-keys.go @@ -1,33 +1,41 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IAMUserSSHKey struct { - svc iamiface.IAMAPI - userName string - sshKeyID string -} +const IAMUserSSHPublicKeyResource = "IAMUserSSHPublicKey" func init() { - register("IAMUserSSHPublicKey", ListIAMUserSSHPublicKeys) + resource.Register(resource.Registration{ + Name: IAMUserSSHPublicKeyResource, + Scope: nuke.Account, + Lister: &IAMUserSSHPublicKeyLister{}, + }) } -func ListIAMUserSSHPublicKeys(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMUserSSHPublicKeyLister struct{} + +func (l *IAMUserSSHPublicKeyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := iam.New(opts.Session) usersOutput, err := svc.ListUsers(nil) if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource for _, user := range usersOutput.Users { listOutput, err := svc.ListSSHPublicKeys(&iam.ListSSHPublicKeysInput{ UserName: user.UserName, @@ -49,6 +57,12 @@ func ListIAMUserSSHPublicKeys(sess *session.Session) ([]Resource, error) { return resources, nil } +type IAMUserSSHKey struct { + svc iamiface.IAMAPI + userName string + sshKeyID string +} + func (u *IAMUserSSHKey) Properties() types.Properties { return types.NewProperties(). Set("UserName", u.userName). @@ -59,7 +73,7 @@ func (u *IAMUserSSHKey) String() string { return fmt.Sprintf("%s -> %s", u.userName, u.sshKeyID) } -func (u *IAMUserSSHKey) Remove() error { +func (u *IAMUserSSHKey) Remove(_ context.Context) error { _, err := u.svc.DeleteSSHPublicKey(&iam.DeleteSSHPublicKeyInput{ UserName: &u.userName, SSHPublicKeyId: &u.sshKeyID, diff --git a/resources/iam-user-ssh-keys_mock_test.go b/resources/iam-user-ssh-keys_mock_test.go index 4bcb7e187..4af5b6ea3 100644 --- a/resources/iam-user-ssh-keys_mock_test.go +++ b/resources/iam-user-ssh-keys_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMUserSSHKeys_Remove(t *testing.T) { @@ -28,6 +31,6 @@ func Test_Mock_IAMUserSSHKeys_Remove(t *testing.T) { SSHPublicKeyId: aws.String(iamUserSSHKey.sshKeyID), })).Return(&iam.DeleteSSHPublicKeyOutput{}, nil) - err := iamUserSSHKey.Remove() + err := iamUserSSHKey.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-users.go b/resources/iam-users.go index 959b14437..94015bde8 100644 --- a/resources/iam-users.go +++ b/resources/iam-users.go @@ -1,23 +1,70 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const IAMUserResource = "IAMUser" + +func init() { + resource.Register(resource.Registration{ + Name: IAMUserResource, + Scope: nuke.Account, + Lister: &IAMUsersLister{}, + DependsOn: []string{ + IAMUserAccessKeyResource, + IAMUserHTTPSGitCredentialResource, + IAMUserGroupAttachmentResource, + IAMUserPolicyAttachmentResource, + IAMVirtualMFADeviceResource, + }, + }) +} + type IAMUser struct { svc iamiface.IAMAPI name string tags []*iam.Tag } -func init() { - register("IAMUser", ListIAMUsers) +func (e *IAMUser) Remove(_ context.Context) error { + _, err := e.svc.DeleteUser(&iam.DeleteUserInput{ + UserName: &e.name, + }) + if err != nil { + return err + } + + return nil +} + +func (e *IAMUser) String() string { + return e.name +} + +func (e *IAMUser) Properties() types.Properties { + properties := types.NewProperties() + properties.Set("Name", e.name) + + for _, tag := range e.tags { + properties.SetTag(tag.Key, tag.Value) + } + + return properties } +// -------------- + func GetIAMUser(svc *iam.IAM, userName *string) (*iam.User, error) { params := &iam.GetUserInput{ UserName: userName, @@ -26,11 +73,17 @@ func GetIAMUser(svc *iam.IAM, userName *string) (*iam.User, error) { return resp.User, err } -func ListIAMUsers(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) - var resources []Resource +// -------------- + +type IAMUsersLister struct{} + +func (l *IAMUsersLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := iam.New(opts.Session) - err := svc.ListUsersPages(nil, func(page *iam.ListUsersOutput, lastPage bool) bool { + var resources []resource.Resource + + if err := svc.ListUsersPages(nil, func(page *iam.ListUsersOutput, lastPage bool) bool { for _, out := range page.Users { user, err := GetIAMUser(svc, out.UserName) if err != nil { @@ -44,36 +97,9 @@ func ListIAMUsers(sess *session.Session) ([]Resource, error) { }) } return true - }) - if err != nil { + }); err != nil { return nil, err } return resources, nil } - -func (e *IAMUser) Remove() error { - _, err := e.svc.DeleteUser(&iam.DeleteUserInput{ - UserName: &e.name, - }) - if err != nil { - return err - } - - return nil -} - -func (e *IAMUser) String() string { - return e.name -} - -func (e *IAMUser) Properties() types.Properties { - properties := types.NewProperties() - properties.Set("Name", e.name) - - for _, tag := range e.tags { - properties.SetTag(tag.Key, tag.Value) - } - - return properties -} diff --git a/resources/iam-users_mock_test.go b/resources/iam-users_mock_test.go index 1f60a47b9..6652c9bfe 100644 --- a/resources/iam-users_mock_test.go +++ b/resources/iam-users_mock_test.go @@ -1,13 +1,17 @@ package resources import ( + "context" + "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMUser_Remove(t *testing.T) { @@ -26,6 +30,6 @@ func Test_Mock_IAMUser_Remove(t *testing.T) { UserName: aws.String(iamUser.name), })).Return(&iam.DeleteUserOutput{}, nil) - err := iamUser.Remove() + err := iamUser.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/iam-users_test.go b/resources/iam-users_test.go new file mode 100644 index 000000000..d159851c7 --- /dev/null +++ b/resources/iam-users_test.go @@ -0,0 +1,52 @@ +//go:build integration + +package resources + +import ( + "context" + "errors" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/iam" +) + +func Test_IAMUser_Remove(t *testing.T) { + sess := session.Must(session.NewSession()) + svc := iam.New(sess) + + createInput := &iam.CreateUserInput{ + UserName: aws.String("test-user"), + Tags: []*iam.Tag{ + { + Key: aws.String("test-key"), + Value: aws.String("test-value"), + }, + }, + } + out, err := svc.CreateUser(createInput) + + assert.NoError(t, err) + assert.Equal(t, "test-user", *out.User.UserName) + + iamUser := IAMUser{ + svc: svc, + name: "test-user", + tags: createInput.Tags, + } + + removeError := iamUser.Remove(context.TODO()) + assert.NoError(t, removeError) + + _, err = svc.GetUser(&iam.GetUserInput{ + UserName: aws.String("test-user"), + }) + var awsError awserr.Error + if errors.As(err, &awsError) { + assert.Equal(t, "NoSuchEntity", awsError.Code()) + } +} diff --git a/resources/iam-virtual-mfa-devices.go b/resources/iam-virtual-mfa-devices.go index e55460646..0c4b11e40 100644 --- a/resources/iam-virtual-mfa-devices.go +++ b/resources/iam-virtual-mfa-devices.go @@ -1,38 +1,45 @@ package resources import ( + "context" + "errors" "fmt" - "github.com/aws/smithy-go/ptr" "strings" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam/iamiface" + + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) -type IAMVirtualMFADevice struct { - svc iamiface.IAMAPI - userId *string - userArn *string - userName string - serialNumber string -} +const IAMVirtualMFADeviceResource = "IAMVirtualMFADevice" func init() { - register("IAMVirtualMFADevice", ListIAMVirtualMFADevices) + resource.Register(resource.Registration{ + Name: IAMVirtualMFADeviceResource, + Scope: nuke.Account, + Lister: &IAMVirtualMFADeviceLister{}, + }) } -func ListIAMVirtualMFADevices(sess *session.Session) ([]Resource, error) { - svc := iam.New(sess) +type IAMVirtualMFADeviceLister struct{} + +func (l *IAMVirtualMFADeviceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iam.New(opts.Session) resp, err := svc.ListVirtualMFADevices(&iam.ListVirtualMFADevicesInput{}) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.VirtualMFADevices { resources = append(resources, &IAMVirtualMFADevice{ svc: svc, @@ -46,6 +53,14 @@ func ListIAMVirtualMFADevices(sess *session.Session) ([]Resource, error) { return resources, nil } +type IAMVirtualMFADevice struct { + svc iamiface.IAMAPI + userId *string + userArn *string + userName string + serialNumber string +} + func (v *IAMVirtualMFADevice) Filter() error { isRoot := false if ptr.ToString(v.userArn) == fmt.Sprintf("arn:aws:iam::%s:root", ptr.ToString(v.userId)) { @@ -62,7 +77,7 @@ func (v *IAMVirtualMFADevice) Filter() error { return nil } -func (v *IAMVirtualMFADevice) Remove() error { +func (v *IAMVirtualMFADevice) Remove(_ context.Context) error { if _, err := v.svc.DeactivateMFADevice(&iam.DeactivateMFADeviceInput{ UserName: aws.String(v.userName), SerialNumber: aws.String(v.serialNumber), diff --git a/resources/iam-virtual-mfa-devices_mock_test.go b/resources/iam-virtual-mfa-devices_mock_test.go index 4641bf82a..a7797f23d 100644 --- a/resources/iam-virtual-mfa-devices_mock_test.go +++ b/resources/iam-virtual-mfa-devices_mock_test.go @@ -1,13 +1,16 @@ package resources import ( + "context" "testing" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/iam" "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_iamiface" "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/iam" + + "github.com/ekristen/aws-nuke/mocks/mock_iamiface" ) func Test_Mock_IAMVirtualMFADevice_Remove(t *testing.T) { @@ -32,6 +35,6 @@ func Test_Mock_IAMVirtualMFADevice_Remove(t *testing.T) { SerialNumber: aws.String(iamVirtualMFADevice.serialNumber), })).Return(&iam.DeleteVirtualMFADeviceOutput{}, nil) - err := iamVirtualMFADevice.Remove() + err := iamVirtualMFADevice.Remove(context.TODO()) a.Nil(err) } diff --git a/resources/imagebuilder-components.go b/resources/imagebuilder-components.go index 36a214919..7c357c91c 100644 --- a/resources/imagebuilder-components.go +++ b/resources/imagebuilder-components.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/imagebuilder" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ImageBuilderComponent struct { - svc *imagebuilder.Imagebuilder - arn string -} +const ImageBuilderComponentResource = "ImageBuilderComponent" func init() { - register("ImageBuilderComponent", ListImageBuilderComponents) + resource.Register(resource.Registration{ + Name: ImageBuilderComponentResource, + Scope: nuke.Account, + Lister: &ImageBuilderComponentLister{}, + }) } -func ListImageBuilderComponents(sess *session.Session) ([]Resource, error) { - svc := imagebuilder.New(sess) +type ImageBuilderComponentLister struct{} + +func (l *ImageBuilderComponentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := imagebuilder.New(opts.Session) params := &imagebuilder.ListComponentsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListComponents(params) @@ -45,7 +55,7 @@ func ListImageBuilderComponents(sess *session.Session) ([]Resource, error) { return resources, nil } -func ListImageBuilderComponentVersions(svc *imagebuilder.Imagebuilder, componentVersionArn *string, resources []Resource) ([]Resource, error) { +func ListImageBuilderComponentVersions(svc *imagebuilder.Imagebuilder, componentVersionArn *string, resources []resource.Resource) ([]resource.Resource, error) { params := &imagebuilder.ListComponentBuildVersionsInput{ ComponentVersionArn: componentVersionArn, } @@ -75,7 +85,12 @@ func ListImageBuilderComponentVersions(svc *imagebuilder.Imagebuilder, component return resources, nil } -func (e *ImageBuilderComponent) Remove() error { +type ImageBuilderComponent struct { + svc *imagebuilder.Imagebuilder + arn string +} + +func (e *ImageBuilderComponent) Remove(_ context.Context) error { _, err := e.svc.DeleteComponent(&imagebuilder.DeleteComponentInput{ ComponentBuildVersionArn: &e.arn, }) diff --git a/resources/imagebuilder-distribution-configurations.go b/resources/imagebuilder-distribution-configurations.go index 154001ba9..d7c537dcc 100644 --- a/resources/imagebuilder-distribution-configurations.go +++ b/resources/imagebuilder-distribution-configurations.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/imagebuilder" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ImageBuilderDistributionConfiguration struct { - svc *imagebuilder.Imagebuilder - arn string -} +const ImageBuilderDistributionConfigurationResource = "ImageBuilderDistributionConfiguration" func init() { - register("ImageBuilderDistributionConfiguration", ListImageBuilderDistributionConfigurations) + resource.Register(resource.Registration{ + Name: ImageBuilderDistributionConfigurationResource, + Scope: nuke.Account, + Lister: &ImageBuilderDistributionConfigurationLister{}, + }) } -func ListImageBuilderDistributionConfigurations(sess *session.Session) ([]Resource, error) { - svc := imagebuilder.New(sess) +type ImageBuilderDistributionConfigurationLister struct{} + +func (l *ImageBuilderDistributionConfigurationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := imagebuilder.New(opts.Session) params := &imagebuilder.ListDistributionConfigurationsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListDistributionConfigurations(params) @@ -45,7 +55,12 @@ func ListImageBuilderDistributionConfigurations(sess *session.Session) ([]Resour return resources, nil } -func (e *ImageBuilderDistributionConfiguration) Remove() error { +type ImageBuilderDistributionConfiguration struct { + svc *imagebuilder.Imagebuilder + arn string +} + +func (e *ImageBuilderDistributionConfiguration) Remove(_ context.Context) error { _, err := e.svc.DeleteDistributionConfiguration(&imagebuilder.DeleteDistributionConfigurationInput{ DistributionConfigurationArn: &e.arn, }) diff --git a/resources/imagebuilder-images.go b/resources/imagebuilder-images.go index 7c1c1015c..afddc5e05 100644 --- a/resources/imagebuilder-images.go +++ b/resources/imagebuilder-images.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/imagebuilder" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ImageBuilderImage struct { - svc *imagebuilder.Imagebuilder - arn string -} +const ImageBuilderImageResource = "ImageBuilderImage" func init() { - register("ImageBuilderImage", ListImageBuilderImages) + resource.Register(resource.Registration{ + Name: ImageBuilderImageResource, + Scope: nuke.Account, + Lister: &ImageBuilderImageLister{}, + }) } -func ListImageBuilderImages(sess *session.Session) ([]Resource, error) { - svc := imagebuilder.New(sess) +type ImageBuilderImageLister struct{} + +func (l *ImageBuilderImageLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := imagebuilder.New(opts.Session) params := &imagebuilder.ListImagesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListImages(params) @@ -45,7 +55,7 @@ func ListImageBuilderImages(sess *session.Session) ([]Resource, error) { return resources, nil } -func ImageBuildVersions(svc *imagebuilder.Imagebuilder, imageVersionArn *string, resources []Resource) ([]Resource, error) { +func ImageBuildVersions(svc *imagebuilder.Imagebuilder, imageVersionArn *string, resources []resource.Resource) ([]resource.Resource, error) { params := &imagebuilder.ListImageBuildVersionsInput{ ImageVersionArn: imageVersionArn, } @@ -75,7 +85,12 @@ func ImageBuildVersions(svc *imagebuilder.Imagebuilder, imageVersionArn *string, return resources, nil } -func (e *ImageBuilderImage) Remove() error { +type ImageBuilderImage struct { + svc *imagebuilder.Imagebuilder + arn string +} + +func (e *ImageBuilderImage) Remove(_ context.Context) error { _, err := e.svc.DeleteImage(&imagebuilder.DeleteImageInput{ ImageBuildVersionArn: &e.arn, }) diff --git a/resources/imagebuilder-infrastructure-configurations.go b/resources/imagebuilder-infrastructure-configurations.go index aed1defa0..27bce7a76 100644 --- a/resources/imagebuilder-infrastructure-configurations.go +++ b/resources/imagebuilder-infrastructure-configurations.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/imagebuilder" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ImageBuilderInfrastructureConfiguration struct { - svc *imagebuilder.Imagebuilder - arn string -} +const ImageBuilderInfrastructureConfigurationResource = "ImageBuilderInfrastructureConfiguration" func init() { - register("ImageBuilderInfrastructureConfiguration", ListImageBuilderInfrastructureConfigurations) + resource.Register(resource.Registration{ + Name: ImageBuilderInfrastructureConfigurationResource, + Scope: nuke.Account, + Lister: &ImageBuilderInfrastructureConfigurationLister{}, + }) } -func ListImageBuilderInfrastructureConfigurations(sess *session.Session) ([]Resource, error) { - svc := imagebuilder.New(sess) +type ImageBuilderInfrastructureConfigurationLister struct{} + +func (l *ImageBuilderInfrastructureConfigurationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := imagebuilder.New(opts.Session) params := &imagebuilder.ListInfrastructureConfigurationsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListInfrastructureConfigurations(params) @@ -45,7 +55,12 @@ func ListImageBuilderInfrastructureConfigurations(sess *session.Session) ([]Reso return resources, nil } -func (e *ImageBuilderInfrastructureConfiguration) Remove() error { +type ImageBuilderInfrastructureConfiguration struct { + svc *imagebuilder.Imagebuilder + arn string +} + +func (e *ImageBuilderInfrastructureConfiguration) Remove(_ context.Context) error { _, err := e.svc.DeleteInfrastructureConfiguration(&imagebuilder.DeleteInfrastructureConfigurationInput{ InfrastructureConfigurationArn: &e.arn, }) diff --git a/resources/imagebuilder-pipelines.go b/resources/imagebuilder-pipelines.go index 0492242d3..ac8956178 100644 --- a/resources/imagebuilder-pipelines.go +++ b/resources/imagebuilder-pipelines.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/imagebuilder" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ImageBuilderPipeline struct { - svc *imagebuilder.Imagebuilder - arn string -} +const ImageBuilderPipelineResource = "ImageBuilderPipeline" func init() { - register("ImageBuilderPipeline", ListImageBuilderPipelines) + resource.Register(resource.Registration{ + Name: ImageBuilderPipelineResource, + Scope: nuke.Account, + Lister: &ImageBuilderPipelineLister{}, + }) } -func ListImageBuilderPipelines(sess *session.Session) ([]Resource, error) { - svc := imagebuilder.New(sess) +type ImageBuilderPipelineLister struct{} + +func (l *ImageBuilderPipelineLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := imagebuilder.New(opts.Session) params := &imagebuilder.ListImagePipelinesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListImagePipelines(params) @@ -45,7 +55,12 @@ func ListImageBuilderPipelines(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *ImageBuilderPipeline) Remove() error { +type ImageBuilderPipeline struct { + svc *imagebuilder.Imagebuilder + arn string +} + +func (e *ImageBuilderPipeline) Remove(_ context.Context) error { _, err := e.svc.DeleteImagePipeline(&imagebuilder.DeleteImagePipelineInput{ ImagePipelineArn: &e.arn, }) diff --git a/resources/imagebuilder-recipes.go b/resources/imagebuilder-recipes.go index 536470c21..5a191ed83 100644 --- a/resources/imagebuilder-recipes.go +++ b/resources/imagebuilder-recipes.go @@ -1,24 +1,34 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/imagebuilder" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ImageBuilderRecipe struct { - svc *imagebuilder.Imagebuilder - arn string -} +const ImageBuilderRecipeResource = "ImageBuilderRecipe" func init() { - register("ImageBuilderRecipe", ListImageBuilderRecipes) + resource.Register(resource.Registration{ + Name: ImageBuilderRecipeResource, + Scope: nuke.Account, + Lister: &ImageBuilderRecipeLister{}, + }) } -func ListImageBuilderRecipes(sess *session.Session) ([]Resource, error) { - svc := imagebuilder.New(sess) +type ImageBuilderRecipeLister struct{} + +func (l *ImageBuilderRecipeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := imagebuilder.New(opts.Session) params := &imagebuilder.ListImageRecipesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListImageRecipes(params) @@ -45,7 +55,12 @@ func ListImageBuilderRecipes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *ImageBuilderRecipe) Remove() error { +type ImageBuilderRecipe struct { + svc *imagebuilder.Imagebuilder + arn string +} + +func (e *ImageBuilderRecipe) Remove(_ context.Context) error { _, err := e.svc.DeleteImageRecipe(&imagebuilder.DeleteImageRecipeInput{ ImageRecipeArn: &e.arn, }) diff --git a/resources/inspector-assessment-runs.go b/resources/inspector-assessment-runs.go index c788a8251..6df304da5 100644 --- a/resources/inspector-assessment-runs.go +++ b/resources/inspector-assessment-runs.go @@ -1,28 +1,38 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/inspector" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type InspectorAssessmentRun struct { - svc *inspector.Inspector - arn string -} +const InspectorAssessmentRunResource = "InspectorAssessmentRun" func init() { - register("InspectorAssessmentRun", ListInspectorAssessmentRuns) + resource.Register(resource.Registration{ + Name: InspectorAssessmentRunResource, + Scope: nuke.Account, + Lister: &InspectorAssessmentRunLister{}, + }) } -func ListInspectorAssessmentRuns(sess *session.Session) ([]Resource, error) { - svc := inspector.New(sess) +type InspectorAssessmentRunLister struct{} + +func (l *InspectorAssessmentRunLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := inspector.New(opts.Session) resp, err := svc.ListAssessmentRuns(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.AssessmentRunArns { resources = append(resources, &InspectorAssessmentRun{ svc: svc, @@ -33,7 +43,12 @@ func ListInspectorAssessmentRuns(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *InspectorAssessmentRun) Remove() error { +type InspectorAssessmentRun struct { + svc *inspector.Inspector + arn string +} + +func (e *InspectorAssessmentRun) Remove(_ context.Context) error { _, err := e.svc.DeleteAssessmentRun(&inspector.DeleteAssessmentRunInput{ AssessmentRunArn: &e.arn, }) diff --git a/resources/inspector-assessment-targets.go b/resources/inspector-assessment-targets.go index 0c2485ee8..28f7a3f0e 100644 --- a/resources/inspector-assessment-targets.go +++ b/resources/inspector-assessment-targets.go @@ -1,28 +1,38 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/inspector" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type InspectorAssessmentTarget struct { - svc *inspector.Inspector - arn string -} +const InspectorAssessmentTargetResource = "InspectorAssessmentTarget" func init() { - register("InspectorAssessmentTarget", ListInspectorAssessmentTargets) + resource.Register(resource.Registration{ + Name: InspectorAssessmentTargetResource, + Scope: nuke.Account, + Lister: &InspectorAssessmentTargetLister{}, + }) } -func ListInspectorAssessmentTargets(sess *session.Session) ([]Resource, error) { - svc := inspector.New(sess) +type InspectorAssessmentTargetLister struct{} + +func (l *InspectorAssessmentTargetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := inspector.New(opts.Session) resp, err := svc.ListAssessmentTargets(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.AssessmentTargetArns { resources = append(resources, &InspectorAssessmentTarget{ svc: svc, @@ -33,7 +43,12 @@ func ListInspectorAssessmentTargets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *InspectorAssessmentTarget) Remove() error { +type InspectorAssessmentTarget struct { + svc *inspector.Inspector + arn string +} + +func (e *InspectorAssessmentTarget) Remove(_ context.Context) error { _, err := e.svc.DeleteAssessmentTarget(&inspector.DeleteAssessmentTargetInput{ AssessmentTargetArn: &e.arn, }) diff --git a/resources/inspector-assessment-templates.go b/resources/inspector-assessment-templates.go index 67784e0a3..b3faa559c 100644 --- a/resources/inspector-assessment-templates.go +++ b/resources/inspector-assessment-templates.go @@ -1,28 +1,38 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/inspector" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type InspectorAssessmentTemplate struct { - svc *inspector.Inspector - arn string -} +const InspectorAssessmentTemplateResource = "InspectorAssessmentTemplate" func init() { - register("InspectorAssessmentTemplate", ListInspectorAssessmentTemplates) + resource.Register(resource.Registration{ + Name: InspectorAssessmentTemplateResource, + Scope: nuke.Account, + Lister: &InspectorAssessmentTemplateLister{}, + }) } -func ListInspectorAssessmentTemplates(sess *session.Session) ([]Resource, error) { - svc := inspector.New(sess) +type InspectorAssessmentTemplateLister struct{} + +func (l *InspectorAssessmentTemplateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := inspector.New(opts.Session) resp, err := svc.ListAssessmentTemplates(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, out := range resp.AssessmentTemplateArns { resources = append(resources, &InspectorAssessmentTemplate{ svc: svc, @@ -33,7 +43,12 @@ func ListInspectorAssessmentTemplates(sess *session.Session) ([]Resource, error) return resources, nil } -func (e *InspectorAssessmentTemplate) Remove() error { +type InspectorAssessmentTemplate struct { + svc *inspector.Inspector + arn string +} + +func (e *InspectorAssessmentTemplate) Remove(_ context.Context) error { _, err := e.svc.DeleteAssessmentTemplate(&inspector.DeleteAssessmentTemplateInput{ AssessmentTemplateArn: &e.arn, }) diff --git a/resources/inspector2.go b/resources/inspector2.go index 9f0c3e34e..f4cab2e69 100644 --- a/resources/inspector2.go +++ b/resources/inspector2.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/inspector2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type Inspector2 struct { - svc *inspector2.Inspector2 - accountId *string -} +const Inspector2Resource = "Inspector2" func init() { - register("Inspector2", ListInspector2) + resource.Register(resource.Registration{ + Name: Inspector2Resource, + Scope: nuke.Account, + Lister: &Inspector2Lister{}, + }) } -func ListInspector2(sess *session.Session) ([]Resource, error) { - svc := inspector2.New(sess) +type Inspector2Lister struct{} - resources := make([]Resource, 0) +func (l *Inspector2Lister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := inspector2.New(opts.Session) + + resources := make([]resource.Resource, 0) resp, err := svc.BatchGetAccountStatus(nil) if err != nil { @@ -36,7 +46,12 @@ func ListInspector2(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *Inspector2) Remove() error { +type Inspector2 struct { + svc *inspector2.Inspector2 + accountId *string +} + +func (e *Inspector2) Remove(_ context.Context) error { _, err := e.svc.Disable(&inspector2.DisableInput{ AccountIds: []*string{e.accountId}, ResourceTypes: aws.StringSlice(inspector2.ResourceScanType_Values()), diff --git a/resources/interface.go b/resources/interface.go deleted file mode 100644 index 9edbcab02..000000000 --- a/resources/interface.go +++ /dev/null @@ -1,96 +0,0 @@ -package resources - -import ( - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws/session" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) - -type ResourceListers map[string]ResourceLister - -type ResourceLister func(s *session.Session) ([]Resource, error) - -type Resource interface { - Remove() error -} - -type Filter interface { - Resource - Filter() error -} - -type LegacyStringer interface { - Resource - String() string -} - -type ResourcePropertyGetter interface { - Resource - Properties() types.Properties -} - -type FeatureFlagGetter interface { - Resource - FeatureFlags(config.FeatureFlags) -} - -var resourceListers = make(ResourceListers) - -func register(name string, lister ResourceLister, opts ...registerOption) { - _, exists := resourceListers[name] - if exists { - panic(fmt.Sprintf("a resource with the name %s already exists", name)) - } - - resourceListers[name] = lister - - for _, opt := range opts { - opt(name, lister) - } -} - -var cloudControlMapping = map[string]string{} - -func GetCloudControlMapping() map[string]string { - return cloudControlMapping -} - -type registerOption func(name string, lister ResourceLister) - -func mapCloudControl(typeName string) registerOption { - return func(name string, lister ResourceLister) { - _, exists := cloudControlMapping[typeName] - if exists { - panic(fmt.Sprintf("a cloud control mapping for %s already exists", typeName)) - } - - cloudControlMapping[typeName] = name - } -} - -func GetLister(name string) ResourceLister { - if strings.HasPrefix(name, "AWS::") { - return NewListCloudControlResource(name) - } - return resourceListers[name] -} - -func GetListerNames() []string { - names := []string{} - for resourceType := range GetListers() { - names = append(names, resourceType) - } - - return names -} - -func registerCloudControl(typeName string) { - register(typeName, NewListCloudControlResource(typeName), mapCloudControl(typeName)) -} - -func GetListers() ResourceListers { - return resourceListers -} diff --git a/resources/iot-authorizers.go b/resources/iot-authorizers.go index d6710bfa7..958f370de 100644 --- a/resources/iot-authorizers.go +++ b/resources/iot-authorizers.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTAuthorizer struct { - svc *iot.IoT - name *string -} +const IoTAuthorizerResource = "IoTAuthorizer" func init() { - register("IoTAuthorizer", ListIoTAuthorizers) + resource.Register(resource.Registration{ + Name: IoTAuthorizerResource, + Scope: nuke.Account, + Lister: &IoTAuthorizerLister{}, + }) } -func ListIoTAuthorizers(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTAuthorizerLister struct{} + +func (l *IoTAuthorizerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListAuthorizersInput{} @@ -35,8 +45,12 @@ func ListIoTAuthorizers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTAuthorizer) Remove() error { +type IoTAuthorizer struct { + svc *iot.IoT + name *string +} +func (f *IoTAuthorizer) Remove(_ context.Context) error { _, err := f.svc.DeleteAuthorizer(&iot.DeleteAuthorizerInput{ AuthorizerName: f.name, }) diff --git a/resources/iot-cacertificates.go b/resources/iot-cacertificates.go index 500ab3b2b..5ba953789 100644 --- a/resources/iot-cacertificates.go +++ b/resources/iot-cacertificates.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTCACertificate struct { - svc *iot.IoT - ID *string -} +const IoTCACertificateResource = "IoTCACertificate" func init() { - register("IoTCACertificate", ListIoTCACertificates) + resource.Register(resource.Registration{ + Name: IoTCACertificateResource, + Scope: nuke.Account, + Lister: &IoTCACertificateLister{}, + }) } -func ListIoTCACertificates(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTCACertificateLister struct{} + +func (l *IoTCACertificateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListCACertificatesInput{} @@ -36,8 +46,12 @@ func ListIoTCACertificates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTCACertificate) Remove() error { +type IoTCACertificate struct { + svc *iot.IoT + ID *string +} +func (f *IoTCACertificate) Remove(_ context.Context) error { _, err := f.svc.UpdateCACertificate(&iot.UpdateCACertificateInput{ CertificateId: f.ID, NewStatus: aws.String("INACTIVE"), diff --git a/resources/iot-certificates.go b/resources/iot-certificates.go index 76a5d4cfa..d17990394 100644 --- a/resources/iot-certificates.go +++ b/resources/iot-certificates.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTCertificate struct { - svc *iot.IoT - ID *string -} +const IoTCertificateResource = "IoTCertificate" func init() { - register("IoTCertificate", ListIoTCertificates) + resource.Register(resource.Registration{ + Name: IoTCertificateResource, + Scope: nuke.Account, + Lister: &IoTCertificateLister{}, + }) } -func ListIoTCertificates(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTCertificateLister struct{} + +func (l *IoTCertificateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListCertificatesInput{} @@ -43,8 +53,12 @@ func ListIoTCertificates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTCertificate) Remove() error { +type IoTCertificate struct { + svc *iot.IoT + ID *string +} +func (f *IoTCertificate) Remove(_ context.Context) error { _, err := f.svc.UpdateCertificate(&iot.UpdateCertificateInput{ CertificateId: f.ID, NewStatus: aws.String("INACTIVE"), diff --git a/resources/iot-jobs.go b/resources/iot-jobs.go index 294d7de2c..774bcda74 100644 --- a/resources/iot-jobs.go +++ b/resources/iot-jobs.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTJob struct { - svc *iot.IoT - ID *string - status *string -} +const IoTJobResource = "IoTJob" func init() { - register("IoTJob", ListIoTJobs) + resource.Register(resource.Registration{ + Name: IoTJobResource, + Scope: nuke.Account, + Lister: &IoTJobLister{}, + }) } -func ListIoTJobs(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTJobLister struct{} + +func (l *IoTJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListJobsInput{ MaxResults: aws.Int64(100), @@ -47,7 +56,13 @@ func ListIoTJobs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTJob) Remove() error { +type IoTJob struct { + svc *iot.IoT + ID *string + status *string +} + +func (f *IoTJob) Remove(_ context.Context) error { _, err := f.svc.CancelJob(&iot.CancelJobInput{ JobId: f.ID, diff --git a/resources/iot-otaupdates.go b/resources/iot-otaupdates.go index 1eabad25b..198e02795 100644 --- a/resources/iot-otaupdates.go +++ b/resources/iot-otaupdates.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTOTAUpdate struct { - svc *iot.IoT - ID *string -} +const IoTOTAUpdateResource = "IoTOTAUpdate" func init() { - register("IoTOTAUpdate", ListIoTOTAUpdates) + resource.Register(resource.Registration{ + Name: IoTOTAUpdateResource, + Scope: nuke.Account, + Lister: &IoTOTAUpdateLister{}, + }) } -func ListIoTOTAUpdates(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTOTAUpdateLister struct{} + +func (l *IoTOTAUpdateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListOTAUpdatesInput{ MaxResults: aws.Int64(100), @@ -44,8 +54,12 @@ func ListIoTOTAUpdates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTOTAUpdate) Remove() error { +type IoTOTAUpdate struct { + svc *iot.IoT + ID *string +} +func (f *IoTOTAUpdate) Remove(_ context.Context) error { _, err := f.svc.DeleteOTAUpdate(&iot.DeleteOTAUpdateInput{ OtaUpdateId: f.ID, }) diff --git a/resources/iot-policies.go b/resources/iot-policies.go index c6b9730c3..effa733ab 100644 --- a/resources/iot-policies.go +++ b/resources/iot-policies.go @@ -1,24 +1,73 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTPolicy struct { - svc *iot.IoT - name *string - targets []*string - deprecatedVersions []*string -} +const IoTPolicyResource = "IoTPolicy" func init() { - register("IoTPolicy", ListIoTPolicies) + resource.Register(resource.Registration{ + Name: IoTPolicyResource, + Scope: nuke.Account, + Lister: &IoTPolicyLister{}, + }) +} + +type IoTPolicyLister struct{} + +func (l *IoTPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) + + params := &iot.ListPoliciesInput{ + PageSize: aws.Int64(25), + } + for { + output, err := svc.ListPolicies(params) + if err != nil { + return nil, err + } + + for _, policy := range output.Policies { + p := &IoTPolicy{ + svc: svc, + name: policy.PolicyName, + } + + p, err = listIoTPolicyTargets(p) + if err != nil { + return nil, err + } + + p, err = listIoTPolicyDeprecatedVersions(p) + if err != nil { + return nil, err + } + + resources = append(resources, p) + } + if output.NextMarker == nil { + break + } + + params.Marker = output.NextMarker + } + + return resources, nil } func listIoTPolicyTargets(f *IoTPolicy) (*IoTPolicy, error) { - targets := []*string{} + var targets []*string params := &iot.ListTargetsForPolicyInput{ PolicyName: f.name, @@ -46,7 +95,7 @@ func listIoTPolicyTargets(f *IoTPolicy) (*IoTPolicy, error) { } func listIoTPolicyDeprecatedVersions(f *IoTPolicy) (*IoTPolicy, error) { - deprecatedVersions := []*string{} + var deprecatedVersions []*string params := &iot.ListPolicyVersionsInput{ PolicyName: f.name, @@ -68,62 +117,34 @@ func listIoTPolicyDeprecatedVersions(f *IoTPolicy) (*IoTPolicy, error) { return f, nil } -func ListIoTPolicies(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} - - params := &iot.ListPoliciesInput{ - PageSize: aws.Int64(25), - } - for { - output, err := svc.ListPolicies(params) - if err != nil { - return nil, err - } - - for _, policy := range output.Policies { - p := &IoTPolicy{ - svc: svc, - name: policy.PolicyName, - } - - p, err = listIoTPolicyTargets(p) - if err != nil { - return nil, err - } - - p, err = listIoTPolicyDeprecatedVersions(p) - if err != nil { - return nil, err - } - - resources = append(resources, p) - } - if output.NextMarker == nil { - break - } - - params.Marker = output.NextMarker - } - - return resources, nil +type IoTPolicy struct { + svc *iot.IoT + name *string + targets []*string + deprecatedVersions []*string } -func (f *IoTPolicy) Remove() error { +func (f *IoTPolicy) Remove(_ context.Context) error { // detach attached targets first for _, target := range f.targets { - f.svc.DetachPolicy(&iot.DetachPolicyInput{ + _, err := f.svc.DetachPolicy(&iot.DetachPolicyInput{ PolicyName: f.name, Target: target, }) + if err != nil { + return err + } } // delete deprecated versions for _, version := range f.deprecatedVersions { - f.svc.DeletePolicyVersion(&iot.DeletePolicyVersionInput{ + _, err := f.svc.DeletePolicyVersion(&iot.DeletePolicyVersionInput{ PolicyName: f.name, PolicyVersionId: version, }) + if err != nil { + return err + } } _, err := f.svc.DeletePolicy(&iot.DeletePolicyInput{ diff --git a/resources/iot-rolealiases.go b/resources/iot-rolealiases.go index 016b4499f..34fcdf812 100644 --- a/resources/iot-rolealiases.go +++ b/resources/iot-rolealiases.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTRoleAlias struct { - svc *iot.IoT - roleAlias *string -} +const IoTRoleAliasResource = "IoTRoleAlias" func init() { - register("IoTRoleAlias", ListIoTRoleAliases) + resource.Register(resource.Registration{ + Name: IoTRoleAliasResource, + Scope: nuke.Account, + Lister: &IoTRoleAliasLister{}, + }) } -func ListIoTRoleAliases(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTRoleAliasLister struct{} + +func (l *IoTRoleAliasLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListRoleAliasesInput{ PageSize: aws.Int64(25), @@ -44,8 +54,12 @@ func ListIoTRoleAliases(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTRoleAlias) Remove() error { +type IoTRoleAlias struct { + svc *iot.IoT + roleAlias *string +} +func (f *IoTRoleAlias) Remove(_ context.Context) error { _, err := f.svc.DeleteRoleAlias(&iot.DeleteRoleAliasInput{ RoleAlias: f.roleAlias, }) diff --git a/resources/iot-streams.go b/resources/iot-streams.go index f3b77cb07..6cb7641dc 100644 --- a/resources/iot-streams.go +++ b/resources/iot-streams.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTStream struct { - svc *iot.IoT - ID *string -} +const IoTStreamResource = "IoTStream" func init() { - register("IoTStream", ListIoTStreams) + resource.Register(resource.Registration{ + Name: IoTStreamResource, + Scope: nuke.Account, + Lister: &IoTStreamLister{}, + }) } -func ListIoTStreams(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTStreamLister struct{} + +func (l *IoTStreamLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListStreamsInput{ MaxResults: aws.Int64(100), @@ -44,8 +54,12 @@ func ListIoTStreams(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTStream) Remove() error { +type IoTStream struct { + svc *iot.IoT + ID *string +} +func (f *IoTStream) Remove(_ context.Context) error { _, err := f.svc.DeleteStream(&iot.DeleteStreamInput{ StreamId: f.ID, }) diff --git a/resources/iot-thinggroups.go b/resources/iot-thinggroups.go index 69c93179d..97463da86 100644 --- a/resources/iot-thinggroups.go +++ b/resources/iot-thinggroups.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTThingGroup struct { - svc *iot.IoT - name *string - version *int64 -} +const IoTThingGroupResource = "IoTThingGroup" func init() { - register("IoTThingGroup", ListIoTThingGroups) + resource.Register(resource.Registration{ + Name: IoTThingGroupResource, + Scope: nuke.Account, + Lister: &IoTThingGroupLister{}, + }) } -func ListIoTThingGroups(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} - thingGroups := []*iot.GroupNameAndArn{} +type IoTThingGroupLister struct{} + +func (l *IoTThingGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) + var thingGroups []*iot.GroupNameAndArn params := &iot.ListThingGroupsInput{ MaxResults: aws.Int64(100), @@ -58,8 +67,13 @@ func ListIoTThingGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTThingGroup) Remove() error { +type IoTThingGroup struct { + svc *iot.IoT + name *string + version *int64 +} +func (f *IoTThingGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteThingGroup(&iot.DeleteThingGroupInput{ ThingGroupName: f.name, ExpectedVersion: f.version, diff --git a/resources/iot-things.go b/resources/iot-things.go index 660b5597d..c001c9802 100644 --- a/resources/iot-things.go +++ b/resources/iot-things.go @@ -1,39 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTThing struct { - svc *iot.IoT - name *string - version *int64 - principals []*string -} +const IoTThingResource = "IoTThing" func init() { - register("IoTThing", ListIoTThings) + resource.Register(resource.Registration{ + Name: IoTThingResource, + Scope: nuke.Account, + Lister: &IoTThingLister{}, + }) } -func listIoTThingPrincipals(f *IoTThing) (*IoTThing, error) { - params := &iot.ListThingPrincipalsInput{ - ThingName: f.name, - } +type IoTThingLister struct{} - output, err := f.svc.ListThingPrincipals(params) - if err != nil { - return nil, err - } +func (l *IoTThingLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - f.principals = output.Principals - return f, nil -} - -func ListIoTThings(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListThingsInput{ MaxResults: aws.Int64(100), @@ -67,13 +61,38 @@ func ListIoTThings(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTThing) Remove() error { +// listIoTThingPrincipals lists the principals attached to a thing (helper function) +func listIoTThingPrincipals(f *IoTThing) (*IoTThing, error) { + params := &iot.ListThingPrincipalsInput{ + ThingName: f.name, + } + + output, err := f.svc.ListThingPrincipals(params) + if err != nil { + return nil, err + } + + f.principals = output.Principals + return f, nil +} + +type IoTThing struct { + svc *iot.IoT + name *string + version *int64 + principals []*string +} + +func (f *IoTThing) Remove(_ context.Context) error { // detach attached principals first for _, principal := range f.principals { - f.svc.DetachThingPrincipal(&iot.DetachThingPrincipalInput{ + _, err := f.svc.DetachThingPrincipal(&iot.DetachThingPrincipalInput{ Principal: principal, ThingName: f.name, }) + if err != nil { + return err + } } _, err := f.svc.DeleteThing(&iot.DeleteThingInput{ diff --git a/resources/iot-thingtypes.go b/resources/iot-thingtypes.go index 988453efe..0cab1c8dd 100644 --- a/resources/iot-thingtypes.go +++ b/resources/iot-thingtypes.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTThingType struct { - svc *iot.IoT - name *string -} +const IoTThingTypeResource = "IoTThingType" func init() { - register("IoTThingType", ListIoTThingTypes) + resource.Register(resource.Registration{ + Name: IoTThingTypeResource, + Scope: nuke.Account, + Lister: &IoTThingTypeLister{}, + }) } -func ListIoTThingTypes(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTThingTypeLister struct{} + +func (l *IoTThingTypeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListThingTypesInput{ MaxResults: aws.Int64(100), @@ -44,8 +54,12 @@ func ListIoTThingTypes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTThingType) Remove() error { +type IoTThingType struct { + svc *iot.IoT + name *string +} +func (f *IoTThingType) Remove(_ context.Context) error { _, err := f.svc.DeleteThingType(&iot.DeleteThingTypeInput{ ThingTypeName: f.name, }) diff --git a/resources/iot-thingtypestates.go b/resources/iot-thingtypestates.go index e598ca3d3..6f1adb550 100644 --- a/resources/iot-thingtypestates.go +++ b/resources/iot-thingtypestates.go @@ -1,28 +1,36 @@ package resources import ( + "context" + "fmt" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTThingTypeState struct { - svc *iot.IoT - name *string - deprecated *bool - deprecatedEpoch *time.Time -} +const IoTThingTypeStateResource = "IoTThingTypeState" func init() { - register("IoTThingTypeState", ListIoTThingTypeStates) + resource.Register(resource.Registration{ + Name: IoTThingTypeStateResource, + Scope: nuke.Account, + Lister: &IoTThingTypeStateLister{}, + }) } -func ListIoTThingTypeStates(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTThingTypeStateLister struct{} + +func (l *IoTThingTypeStateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListThingTypesInput{ MaxResults: aws.Int64(100), @@ -51,17 +59,11 @@ func ListIoTThingTypeStates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTThingTypeState) Remove() error { - - _, err := f.svc.DeprecateThingType(&iot.DeprecateThingTypeInput{ - ThingTypeName: f.name, - }) - - return err -} - -func (f *IoTThingTypeState) String() string { - return *f.name +type IoTThingTypeState struct { + svc *iot.IoT + name *string + deprecated *bool + deprecatedEpoch *time.Time } func (f *IoTThingTypeState) Filter() error { @@ -77,3 +79,15 @@ func (f *IoTThingTypeState) Filter() error { } return nil } + +func (f *IoTThingTypeState) Remove(_ context.Context) error { + _, err := f.svc.DeprecateThingType(&iot.DeprecateThingTypeInput{ + ThingTypeName: f.name, + }) + + return err +} + +func (f *IoTThingTypeState) String() string { + return *f.name +} diff --git a/resources/iot-topicrules.go b/resources/iot-topicrules.go index 075eff511..102f6d8ef 100644 --- a/resources/iot-topicrules.go +++ b/resources/iot-topicrules.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/iot" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type IoTTopicRule struct { - svc *iot.IoT - name *string -} +const IoTTopicRuleResource = "IoTTopicRule" func init() { - register("IoTTopicRule", ListIoTTopicRules) + resource.Register(resource.Registration{ + Name: IoTTopicRuleResource, + Scope: nuke.Account, + Lister: &IoTTopicRuleLister{}, + }) } -func ListIoTTopicRules(sess *session.Session) ([]Resource, error) { - svc := iot.New(sess) - resources := []Resource{} +type IoTTopicRuleLister struct{} + +func (l *IoTTopicRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := iot.New(opts.Session) + resources := make([]resource.Resource, 0) params := &iot.ListTopicRulesInput{ MaxResults: aws.Int64(100), @@ -44,8 +54,12 @@ func ListIoTTopicRules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *IoTTopicRule) Remove() error { +type IoTTopicRule struct { + svc *iot.IoT + name *string +} +func (f *IoTTopicRule) Remove(_ context.Context) error { _, err := f.svc.DeleteTopicRule(&iot.DeleteTopicRuleInput{ RuleName: f.name, }) diff --git a/resources/kendra-indexes.go b/resources/kendra-indexes.go index 39e09fb8c..64a7a6e88 100644 --- a/resources/kendra-indexes.go +++ b/resources/kendra-indexes.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kendra" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type KendraIndex struct { - svc *kendra.Kendra - name string - id string -} +const KendraIndexResource = "KendraIndex" func init() { - register("KendraIndex", ListKendraIndexes) + resource.Register(resource.Registration{ + Name: KendraIndexResource, + Scope: nuke.Account, + Lister: &KendraIndexLister{}, + }) } -func ListKendraIndexes(sess *session.Session) ([]Resource, error) { - svc := kendra.New(sess) - resources := []Resource{} +type KendraIndexLister struct{} + +func (l *KendraIndexLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kendra.New(opts.Session) + resources := make([]resource.Resource, 0) params := &kendra.ListIndicesInput{ MaxResults: aws.Int64(100), @@ -46,7 +55,13 @@ func ListKendraIndexes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *KendraIndex) Remove() error { +type KendraIndex struct { + svc *kendra.Kendra + name string + id string +} + +func (i *KendraIndex) Remove(_ context.Context) error { _, err := i.svc.DeleteIndex(&kendra.DeleteIndexInput{ Id: &i.id, }) diff --git a/resources/kinesis-streams.go b/resources/kinesis-streams.go index 0f9f96647..88cb1ecbf 100644 --- a/resources/kinesis-streams.go +++ b/resources/kinesis-streams.go @@ -1,24 +1,36 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kinesis" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type KinesisStream struct { - svc *kinesis.Kinesis - streamName *string -} +const KinesisStreamResource = "KinesisStream" func init() { - register("KinesisStream", ListKinesisStreams) + resource.Register(resource.Registration{ + Name: KinesisStreamResource, + Scope: nuke.Account, + Lister: &KinesisStreamLister{}, + }) } -func ListKinesisStreams(sess *session.Session) ([]Resource, error) { - svc := kinesis.New(sess) - resources := []Resource{} +type KinesisStreamLister struct{} + +func (l *KinesisStreamLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kinesis.New(opts.Session) + + resources := make([]resource.Resource, 0) var lastStreamName *string + params := &kinesis.ListStreamsInput{ Limit: aws.Int64(25), } @@ -47,8 +59,12 @@ func ListKinesisStreams(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *KinesisStream) Remove() error { +type KinesisStream struct { + svc *kinesis.Kinesis + streamName *string +} +func (f *KinesisStream) Remove(_ context.Context) error { _, err := f.svc.DeleteStream(&kinesis.DeleteStreamInput{ StreamName: f.streamName, }) diff --git a/resources/kinesisanalytics-streams.go b/resources/kinesisanalytics-streams.go index 372270575..bc35aceb5 100644 --- a/resources/kinesisanalytics-streams.go +++ b/resources/kinesisanalytics-streams.go @@ -1,23 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kinesisanalyticsv2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type KinesisAnalyticsApplication struct { - svc *kinesisanalyticsv2.KinesisAnalyticsV2 - applicationName *string -} +const KinesisAnalyticsApplicationResource = "KinesisAnalyticsApplication" func init() { - register("KinesisAnalyticsApplication", ListKinesisAnalyticsApplications) + resource.Register(resource.Registration{ + Name: KinesisAnalyticsApplicationResource, + Scope: nuke.Account, + Lister: &KinesisAnalyticsApplicationLister{}, + }) } -func ListKinesisAnalyticsApplications(sess *session.Session) ([]Resource, error) { - svc := kinesisanalyticsv2.New(sess) - resources := []Resource{} +type KinesisAnalyticsApplicationLister struct{} + +func (l *KinesisAnalyticsApplicationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kinesisanalyticsv2.New(opts.Session) + + resources := make([]resource.Resource, 0) + params := &kinesisanalyticsv2.ListApplicationsInput{ Limit: aws.Int64(25), } @@ -45,8 +57,12 @@ func ListKinesisAnalyticsApplications(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *KinesisAnalyticsApplication) Remove() error { +type KinesisAnalyticsApplication struct { + svc *kinesisanalyticsv2.KinesisAnalyticsV2 + applicationName *string +} +func (f *KinesisAnalyticsApplication) Remove(_ context.Context) error { output, err := f.svc.DescribeApplication(&kinesisanalyticsv2.DescribeApplicationInput{ ApplicationName: f.applicationName, }) diff --git a/resources/kinesisvideo-streams.go b/resources/kinesisvideo-streams.go index 3852888a7..dd6991771 100644 --- a/resources/kinesisvideo-streams.go +++ b/resources/kinesisvideo-streams.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kinesisvideo" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type KinesisVideoProject struct { - svc *kinesisvideo.KinesisVideo - streamARN *string -} +const KinesisVideoProjectResource = "KinesisVideoProject" func init() { - register("KinesisVideoProject", ListKinesisVideoProjects) + resource.Register(resource.Registration{ + Name: KinesisVideoProjectResource, + Scope: nuke.Account, + Lister: &KinesisVideoProjectLister{}, + }) } -func ListKinesisVideoProjects(sess *session.Session) ([]Resource, error) { - svc := kinesisvideo.New(sess) - resources := []Resource{} +type KinesisVideoProjectLister struct{} + +func (l *KinesisVideoProjectLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kinesisvideo.New(opts.Session) + resources := make([]resource.Resource, 0) params := &kinesisvideo.ListStreamsInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListKinesisVideoProjects(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *KinesisVideoProject) Remove() error { +type KinesisVideoProject struct { + svc *kinesisvideo.KinesisVideo + streamARN *string +} +func (f *KinesisVideoProject) Remove(_ context.Context) error { _, err := f.svc.DeleteStream(&kinesisvideo.DeleteStreamInput{ StreamARN: f.streamARN, }) diff --git a/resources/kms-aliases.go b/resources/kms-aliases.go index e7d6a8552..a1602393e 100644 --- a/resources/kms-aliases.go +++ b/resources/kms-aliases.go @@ -1,42 +1,59 @@ package resources import ( + "context" + "fmt" "strings" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/kms" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type KMSAlias struct { - svc *kms.KMS - name string -} +const KMSAliasResource = "KMSAlias" func init() { - register("KMSAlias", ListKMSAliases) + resource.Register(resource.Registration{ + Name: KMSAliasResource, + Scope: nuke.Account, + Lister: &KMSAliasLister{}, + }) } -func ListKMSAliases(sess *session.Session) ([]Resource, error) { - svc := kms.New(sess) +type KMSAliasLister struct{} + +func (l *KMSAliasLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kms.New(opts.Session) resp, err := svc.ListAliases(nil) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, alias := range resp.Aliases { resources = append(resources, &KMSAlias{ svc: svc, - name: *alias.AliasName, + name: ptr.ToString(alias.AliasName), }) } return resources, nil } +type KMSAlias struct { + svc *kms.KMS + name string +} + func (e *KMSAlias) Filter() error { if strings.HasPrefix(e.name, "alias/aws/") { return fmt.Errorf("cannot delete AWS alias") @@ -44,7 +61,7 @@ func (e *KMSAlias) Filter() error { return nil } -func (e *KMSAlias) Remove() error { +func (e *KMSAlias) Remove(_ context.Context) error { _, err := e.svc.DeleteAlias(&kms.DeleteAliasInput{ AliasName: &e.name, }) diff --git a/resources/kms-keys.go b/resources/kms-keys.go index cfb1193ed..083ac5c65 100644 --- a/resources/kms-keys.go +++ b/resources/kms-keys.go @@ -1,32 +1,42 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kms" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type KMSKey struct { - svc *kms.KMS - id string - state string - manager *string - tags []*kms.Tag -} +const KMSKeyResource = "KMSKey" func init() { - register("KMSKey", ListKMSKeys) + resource.Register(resource.Registration{ + Name: KMSKeyResource, + Scope: nuke.Account, + Lister: &KMSKeyLister{}, + DependsOn: []string{ + KMSAliasResource, + }, + }) } -func ListKMSKeys(sess *session.Session) ([]Resource, error) { - svc := kms.New(sess) - resources := make([]Resource, 0) +type KMSKeyLister struct{} + +func (l *KMSKeyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kms.New(opts.Session) + resources := make([]resource.Resource, 0) var innerErr error - err := svc.ListKeysPages(nil, func(resp *kms.ListKeysOutput, lastPage bool) bool { + if err := svc.ListKeysPages(nil, func(resp *kms.ListKeysOutput, lastPage bool) bool { for _, key := range resp.Keys { resp, err := svc.DescribeKey(&kms.DescribeKeyInput{ KeyId: key.KeyId, @@ -68,19 +78,25 @@ func ListKMSKeys(sess *session.Session) ([]Resource, error) { } return true - }) - - if err != nil { + }); err != nil { return nil, err } if innerErr != nil { - return nil, err + return nil, innerErr } return resources, nil } +type KMSKey struct { + svc *kms.KMS + id string + state string + manager *string + tags []*kms.Tag +} + func (e *KMSKey) Filter() error { if e.state == "PendingDeletion" { return fmt.Errorf("is already in PendingDeletion state") @@ -93,7 +109,7 @@ func (e *KMSKey) Filter() error { return nil } -func (e *KMSKey) Remove() error { +func (e *KMSKey) Remove(_ context.Context) error { _, err := e.svc.ScheduleKeyDeletion(&kms.ScheduleKeyDeletionInput{ KeyId: &e.id, PendingWindowInDays: aws.Int64(7), @@ -105,12 +121,12 @@ func (e *KMSKey) String() string { return e.id } -func (i *KMSKey) Properties() types.Properties { +func (e *KMSKey) Properties() types.Properties { properties := types.NewProperties() properties. - Set("ID", i.id) + Set("ID", e.id) - for _, tag := range i.tags { + for _, tag := range e.tags { properties.SetTag(tag.TagKey, tag.TagValue) } diff --git a/resources/kms-keys_test.go b/resources/kms-keys_test.go new file mode 100644 index 000000000..b26f83c05 --- /dev/null +++ b/resources/kms-keys_test.go @@ -0,0 +1,67 @@ +//go:build integration + +package resources + +import ( + "context" + "fmt" + "testing" + + "github.com/gotidy/ptr" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/kms" + "github.com/aws/aws-sdk-go/service/sts" +) + +func Test_KMSKey_Remove(t *testing.T) { + cfg := aws.NewConfig() + cfg.Region = ptr.String("us-east-1") + + sess := session.Must(session.NewSession(cfg)) + svc := kms.New(sess) + + stsSvc := sts.New(sess) + ident, err := stsSvc.GetCallerIdentity(&sts.GetCallerIdentityInput{}) + assert.NoError(t, err) + + createInput := &kms.CreateKeyInput{ + Policy: aws.String(fmt.Sprintf(`{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "AWS": "arn:aws:iam::%s:root" + }, + "Action": "kms:*", + "Resource": "*" + } + ] + }`, *ident.Account)), + } + + out, err := svc.CreateKey(createInput) + assert.NoError(t, err) + assert.NotNil(t, out) + + kmsKey := KMSKey{ + svc: svc, + id: *out.KeyMetadata.KeyId, + } + + removeError := kmsKey.Remove(context.TODO()) + assert.NoError(t, removeError) + + _, err = svc.DescribeKey(&kms.DescribeKeyInput{ + KeyId: aws.String(kmsKey.id), + }) + var awsError awserr.Error + if errors.As(err, &awsError) { + assert.Equal(t, "NoSuchEntity", awsError.Code()) + } +} diff --git a/resources/lambda-event-source-mapping.go b/resources/lambda-event-source-mapping.go index e1053890c..34b7421a7 100644 --- a/resources/lambda-event-source-mapping.go +++ b/resources/lambda-event-source-mapping.go @@ -1,23 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/lambda" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LambdaEventSourceMapping struct { - svc *lambda.Lambda - mapping *lambda.EventSourceMappingConfiguration -} +const LambdaEventSourceMappingResource = "LambdaEventSourceMapping" func init() { - register("LambdaEventSourceMapping", ListLambdaEventSourceMapping) + resource.Register(resource.Registration{ + Name: LambdaEventSourceMappingResource, + Scope: nuke.Account, + Lister: &LambdaEventSourceMappingLister{}, + }) } -func ListLambdaEventSourceMapping(sess *session.Session) ([]Resource, error) { - svc := lambda.New(sess) - resources := []Resource{} +type LambdaEventSourceMappingLister struct{} + +func (l *LambdaEventSourceMappingLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lambda.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lambda.ListEventSourceMappingsInput{} for { @@ -43,7 +53,12 @@ func ListLambdaEventSourceMapping(sess *session.Session) ([]Resource, error) { return resources, nil } -func (m *LambdaEventSourceMapping) Remove() error { +type LambdaEventSourceMapping struct { + svc *lambda.Lambda + mapping *lambda.EventSourceMappingConfiguration +} + +func (m *LambdaEventSourceMapping) Remove(_ context.Context) error { _, err := m.svc.DeleteEventSourceMapping(&lambda.DeleteEventSourceMappingInput{ UUID: m.mapping.UUID, }) @@ -57,5 +72,6 @@ func (m *LambdaEventSourceMapping) Properties() types.Properties { properties.Set("EventSourceArn", m.mapping.EventSourceArn) properties.Set("FunctionArn", m.mapping.FunctionArn) properties.Set("State", m.mapping.State) + return properties } diff --git a/resources/lambda-functions.go b/resources/lambda-functions.go index 8b6e72455..1fc86dab4 100644 --- a/resources/lambda-functions.go +++ b/resources/lambda-functions.go @@ -1,23 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/lambda" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LambdaFunction struct { - svc *lambda.Lambda - functionName *string - tags map[string]*string -} +const LambdaFunctionResource = "LambdaFunction" func init() { - register("LambdaFunction", ListLambdaFunctions) + resource.Register(resource.Registration{ + Name: LambdaFunctionResource, + Scope: nuke.Account, + Lister: &LambdaFunctionLister{}, + }) } -func ListLambdaFunctions(sess *session.Session) ([]Resource, error) { - svc := lambda.New(sess) +type LambdaFunctionLister struct{} + +func (l *LambdaFunctionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lambda.New(opts.Session) functions := make([]*lambda.FunctionConfiguration, 0) @@ -34,7 +43,7 @@ func ListLambdaFunctions(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, function := range functions { tags, err := svc.ListTags(&lambda.ListTagsInput{ Resource: function.FunctionArn, @@ -54,6 +63,12 @@ func ListLambdaFunctions(sess *session.Session) ([]Resource, error) { return resources, nil } +type LambdaFunction struct { + svc *lambda.Lambda + functionName *string + tags map[string]*string +} + func (f *LambdaFunction) Properties() types.Properties { properties := types.NewProperties() properties.Set("Name", f.functionName) @@ -65,8 +80,7 @@ func (f *LambdaFunction) Properties() types.Properties { return properties } -func (f *LambdaFunction) Remove() error { - +func (f *LambdaFunction) Remove(_ context.Context) error { _, err := f.svc.DeleteFunction(&lambda.DeleteFunctionInput{ FunctionName: f.functionName, }) diff --git a/resources/lambda-layers.go b/resources/lambda-layers.go index e7183c1a5..4848108c2 100644 --- a/resources/lambda-layers.go +++ b/resources/lambda-layers.go @@ -1,23 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/lambda" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type lambdaLayer struct { - svc *lambda.Lambda - layerName *string - version int64 -} +const LambdaLayerResource = "LambdaLayer" func init() { - register("LambdaLayer", ListLambdaLayers) + resource.Register(resource.Registration{ + Name: LambdaLayerResource, + Scope: nuke.Account, + Lister: &LambdaLayerLister{}, + }) } -func ListLambdaLayers(sess *session.Session) ([]Resource, error) { - svc := lambda.New(sess) +type LambdaLayerLister struct{} + +func (l *LambdaLayerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lambda.New(opts.Session) layers := make([]*lambda.LayersListItem, 0) @@ -33,7 +42,7 @@ func ListLambdaLayers(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, layer := range layers { versionsParams := &lambda.ListLayerVersionsInput{ @@ -41,7 +50,7 @@ func ListLambdaLayers(sess *session.Session) ([]Resource, error) { } err := svc.ListLayerVersionsPages(versionsParams, func(page *lambda.ListLayerVersionsOutput, lastPage bool) bool { for _, out := range page.LayerVersions { - resources = append(resources, &lambdaLayer{ + resources = append(resources, &LambdaLayer{ svc: svc, layerName: layer.LayerName, version: *out.Version, @@ -52,13 +61,18 @@ func ListLambdaLayers(sess *session.Session) ([]Resource, error) { if err != nil { return nil, err } - } return resources, nil } -func (l *lambdaLayer) Remove() error { +type LambdaLayer struct { + svc *lambda.Lambda + layerName *string + version int64 +} + +func (l *LambdaLayer) Remove(_ context.Context) error { _, err := l.svc.DeleteLayerVersion(&lambda.DeleteLayerVersionInput{ LayerName: l.layerName, @@ -68,7 +82,7 @@ func (l *lambdaLayer) Remove() error { return err } -func (l *lambdaLayer) Properties() types.Properties { +func (l *LambdaLayer) Properties() types.Properties { properties := types.NewProperties() properties.Set("Name", l.layerName) properties.Set("Version", l.version) @@ -76,6 +90,6 @@ func (l *lambdaLayer) Properties() types.Properties { return properties } -func (l *lambdaLayer) String() string { +func (l *LambdaLayer) String() string { return *l.layerName } diff --git a/resources/lex-bot.go b/resources/lex-bot.go index a626b5db4..a1d35b85b 100644 --- a/resources/lex-bot.go +++ b/resources/lex-bot.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lexmodelbuildingservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LexBot struct { - svc *lexmodelbuildingservice.LexModelBuildingService - name *string - status *string -} +const LexBotResource = "LexBot" func init() { - register("LexBot", ListLexBots) + resource.Register(resource.Registration{ + Name: LexBotResource, + Scope: nuke.Account, + Lister: &LexBotLister{}, + }) } -func ListLexBots(sess *session.Session) ([]Resource, error) { - svc := lexmodelbuildingservice.New(sess) - resources := []Resource{} +type LexBotLister struct{} + +func (l *LexBotLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lexmodelbuildingservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lexmodelbuildingservice.GetBotsInput{ MaxResults: aws.Int64(10), @@ -49,8 +58,13 @@ func ListLexBots(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LexBot) Remove() error { +type LexBot struct { + svc *lexmodelbuildingservice.LexModelBuildingService + name *string + status *string +} +func (f *LexBot) Remove(_ context.Context) error { _, err := f.svc.DeleteBot(&lexmodelbuildingservice.DeleteBotInput{ Name: f.name, }) diff --git a/resources/lex-intent.go b/resources/lex-intent.go index b587f3152..230e792a9 100644 --- a/resources/lex-intent.go +++ b/resources/lex-intent.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lexmodelbuildingservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LexIntent struct { - svc *lexmodelbuildingservice.LexModelBuildingService - name *string -} +const LexIntentResource = "LexIntent" func init() { - register("LexIntent", ListLexIntents) + resource.Register(resource.Registration{ + Name: LexIntentResource, + Scope: nuke.Account, + Lister: &LexIntentLister{}, + }) } -func ListLexIntents(sess *session.Session) ([]Resource, error) { - svc := lexmodelbuildingservice.New(sess) - resources := []Resource{} +type LexIntentLister struct{} + +func (l *LexIntentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lexmodelbuildingservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lexmodelbuildingservice.GetIntentsInput{ MaxResults: aws.Int64(20), @@ -47,8 +57,12 @@ func ListLexIntents(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LexIntent) Remove() error { +type LexIntent struct { + svc *lexmodelbuildingservice.LexModelBuildingService + name *string +} +func (f *LexIntent) Remove(_ context.Context) error { _, err := f.svc.DeleteIntent(&lexmodelbuildingservice.DeleteIntentInput{ Name: f.name, }) diff --git a/resources/lex-model-building-service-bot-alias.go b/resources/lex-model-building-service-bot-alias.go index bca7285d3..ca8b33222 100644 --- a/resources/lex-model-building-service-bot-alias.go +++ b/resources/lex-model-building-service-bot-alias.go @@ -1,26 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lexmodelbuildingservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LexModelBuildingServiceBotAlias struct { - svc *lexmodelbuildingservice.LexModelBuildingService - name *string - checksum *string - botName *string -} +const LexModelBuildingServiceBotAliasResource = "LexModelBuildingServiceBotAlias" func init() { - register("LexModelBuildingServiceBotAlias", ListLexModelBuildingServiceBotAliases) + resource.Register(resource.Registration{ + Name: LexModelBuildingServiceBotAliasResource, + Scope: nuke.Account, + Lister: &LexModelBuildingServiceBotAliasLister{}, + }) } -func ListLexModelBuildingServiceBotAliases(sess *session.Session) ([]Resource, error) { - svc := lexmodelbuildingservice.New(sess) - resources := []Resource{} +type LexModelBuildingServiceBotAliasLister struct{} + +func (l *LexModelBuildingServiceBotAliasLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lexmodelbuildingservice.New(opts.Session) + resources := make([]resource.Resource, 0) botParams := &lexmodelbuildingservice.GetBotsInput{ MaxResults: aws.Int64(10), @@ -69,7 +77,14 @@ func ListLexModelBuildingServiceBotAliases(sess *session.Session) ([]Resource, e return resources, nil } -func (f *LexModelBuildingServiceBotAlias) Remove() error { +type LexModelBuildingServiceBotAlias struct { + svc *lexmodelbuildingservice.LexModelBuildingService + name *string + checksum *string + botName *string +} + +func (f *LexModelBuildingServiceBotAlias) Remove(_ context.Context) error { params := &lexmodelbuildingservice.DeleteBotAliasInput{ BotName: f.botName, Name: f.name, diff --git a/resources/lex-slot-types.go b/resources/lex-slot-types.go index 18e672a05..cc583dc32 100644 --- a/resources/lex-slot-types.go +++ b/resources/lex-slot-types.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lexmodelbuildingservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LexSlotType struct { - svc *lexmodelbuildingservice.LexModelBuildingService - name *string -} +const LexSlotTypeResource = "LexSlotType" func init() { - register("LexSlotType", ListLexSlotTypes) + resource.Register(resource.Registration{ + Name: LexSlotTypeResource, + Scope: nuke.Account, + Lister: &LexSlotTypeLister{}, + }) } -func ListLexSlotTypes(sess *session.Session) ([]Resource, error) { - svc := lexmodelbuildingservice.New(sess) - resources := []Resource{} +type LexSlotTypeLister struct{} + +func (l *LexSlotTypeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lexmodelbuildingservice.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lexmodelbuildingservice.GetSlotTypesInput{ MaxResults: aws.Int64(20), @@ -47,8 +57,12 @@ func ListLexSlotTypes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LexSlotType) Remove() error { +type LexSlotType struct { + svc *lexmodelbuildingservice.LexModelBuildingService + name *string +} +func (f *LexSlotType) Remove(_ context.Context) error { _, err := f.svc.DeleteSlotType(&lexmodelbuildingservice.DeleteSlotTypeInput{ Name: f.name, }) diff --git a/resources/lightsail-disks.go b/resources/lightsail-disks.go index 51a4409af..129d6edda 100644 --- a/resources/lightsail-disks.go +++ b/resources/lightsail-disks.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/lightsail" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LightsailDisk struct { - svc *lightsail.Lightsail - diskName *string -} +const LightsailDiskResource = "LightsailDisk" func init() { - register("LightsailDisk", ListLightsailDisks) + resource.Register(resource.Registration{ + Name: LightsailDiskResource, + Scope: nuke.Account, + Lister: &LightsailDiskLister{}, + }) } -func ListLightsailDisks(sess *session.Session) ([]Resource, error) { - svc := lightsail.New(sess) - resources := []Resource{} +type LightsailDiskLister struct{} + +func (l *LightsailDiskLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lightsail.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lightsail.GetDisksInput{} @@ -43,8 +53,12 @@ func ListLightsailDisks(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LightsailDisk) Remove() error { +type LightsailDisk struct { + svc *lightsail.Lightsail + diskName *string +} +func (f *LightsailDisk) Remove(_ context.Context) error { _, err := f.svc.DeleteDisk(&lightsail.DeleteDiskInput{ DiskName: f.diskName, }) diff --git a/resources/lightsail-domains.go b/resources/lightsail-domains.go index 186ade2a1..4736c4fed 100644 --- a/resources/lightsail-domains.go +++ b/resources/lightsail-domains.go @@ -1,25 +1,37 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws/endpoints" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lightsail" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LightsailDomain struct { - svc *lightsail.Lightsail - domainName *string -} +// TODO: implement region hints when we know certain things will never be in other regions + +const LightsailDomainResource = "LightsailDomain" func init() { - register("LightsailDomain", ListLightsailDomains) + resource.Register(resource.Registration{ + Name: LightsailDomainResource, + Scope: nuke.Account, + Lister: &LightsailDomainLister{}, + }) } -func ListLightsailDomains(sess *session.Session) ([]Resource, error) { - svc := lightsail.New(sess) - resources := []Resource{} +type LightsailDomainLister struct{} + +func (l *LightsailDomainLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - if sess.Config.Region == nil || *sess.Config.Region != endpoints.UsEast1RegionID { + svc := lightsail.New(opts.Session) + resources := make([]resource.Resource, 0) + + if opts.Session.Config.Region == nil || *opts.Session.Config.Region != endpoints.UsEast1RegionID { // LightsailDomain only supports us-east-1 return resources, nil } @@ -49,8 +61,12 @@ func ListLightsailDomains(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LightsailDomain) Remove() error { +type LightsailDomain struct { + svc *lightsail.Lightsail + domainName *string +} +func (f *LightsailDomain) Remove(_ context.Context) error { _, err := f.svc.DeleteDomain(&lightsail.DeleteDomainInput{ DomainName: f.domainName, }) diff --git a/resources/lightsail-instances.go b/resources/lightsail-instances.go index dd9c7ce6d..c96bfa6a8 100644 --- a/resources/lightsail-instances.go +++ b/resources/lightsail-instances.go @@ -1,28 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/lightsail" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) -type LightsailInstance struct { - svc *lightsail.Lightsail - instanceName *string - tags []*lightsail.Tag + "github.com/ekristen/libnuke/pkg/featureflag" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" - featureFlags config.FeatureFlags -} + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +const LightsailInstanceResource = "LightsailInstance" func init() { - register("LightsailInstance", ListLightsailInstances) + resource.Register(resource.Registration{ + Name: LightsailInstanceResource, + Scope: nuke.Account, + Lister: &LightsailInstanceLister{}, + }) } -func ListLightsailInstances(sess *session.Session) ([]Resource, error) { - svc := lightsail.New(sess) - resources := []Resource{} +type LightsailInstanceLister struct{} + +func (l *LightsailInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lightsail.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lightsail.GetInstancesInput{} @@ -50,15 +57,27 @@ func ListLightsailInstances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LightsailInstance) FeatureFlags(ff config.FeatureFlags) { +type LightsailInstance struct { + svc *lightsail.Lightsail + instanceName *string + tags []*lightsail.Tag + + featureFlags *featureflag.FeatureFlags +} + +func (f *LightsailInstance) FeatureFlags(ff *featureflag.FeatureFlags) { f.featureFlags = ff } -func (f *LightsailInstance) Remove() error { +func (f *LightsailInstance) Remove(_ context.Context) error { + ffDLA, ffErr := f.featureFlags.Get("ForceDeleteLightsailAddOns") + if ffErr != nil { + return ffErr + } _, err := f.svc.DeleteInstance(&lightsail.DeleteInstanceInput{ InstanceName: f.instanceName, - ForceDeleteAddOns: aws.Bool(f.featureFlags.ForceDeleteLightsailAddOns), + ForceDeleteAddOns: aws.Bool(ffDLA.Enabled()), }) return err diff --git a/resources/lightsail-keypairs.go b/resources/lightsail-keypairs.go index 56a163f01..a10106e79 100644 --- a/resources/lightsail-keypairs.go +++ b/resources/lightsail-keypairs.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/lightsail" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LightsailKeyPair struct { - svc *lightsail.Lightsail - keyPairName *string -} +const LightsailKeyPairResource = "LightsailKeyPair" func init() { - register("LightsailKeyPair", ListLightsailKeyPairs) + resource.Register(resource.Registration{ + Name: LightsailKeyPairResource, + Scope: nuke.Account, + Lister: &LightsailKeyPairLister{}, + }) } -func ListLightsailKeyPairs(sess *session.Session) ([]Resource, error) { - svc := lightsail.New(sess) - resources := []Resource{} +type LightsailKeyPairLister struct{} + +func (l *LightsailKeyPairLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lightsail.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lightsail.GetKeyPairsInput{} @@ -43,8 +53,12 @@ func ListLightsailKeyPairs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LightsailKeyPair) Remove() error { +type LightsailKeyPair struct { + svc *lightsail.Lightsail + keyPairName *string +} +func (f *LightsailKeyPair) Remove(_ context.Context) error { _, err := f.svc.DeleteKeyPair(&lightsail.DeleteKeyPairInput{ KeyPairName: f.keyPairName, }) diff --git a/resources/lightsail-loadbalancers.go b/resources/lightsail-loadbalancers.go index 1e52f4c68..23bfdab12 100644 --- a/resources/lightsail-loadbalancers.go +++ b/resources/lightsail-loadbalancers.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/lightsail" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LightsailLoadBalancer struct { - svc *lightsail.Lightsail - loadBalancerName *string -} +const LightsailLoadBalancerResource = "LightsailLoadBalancer" func init() { - register("LightsailLoadBalancer", ListLightsailLoadBalancers) + resource.Register(resource.Registration{ + Name: LightsailLoadBalancerResource, + Scope: nuke.Account, + Lister: &LightsailLoadBalancerLister{}, + }) } -func ListLightsailLoadBalancers(sess *session.Session) ([]Resource, error) { - svc := lightsail.New(sess) - resources := []Resource{} +type LightsailLoadBalancerLister struct{} + +func (l *LightsailLoadBalancerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lightsail.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lightsail.GetLoadBalancersInput{} @@ -26,10 +36,10 @@ func ListLightsailLoadBalancers(sess *session.Session) ([]Resource, error) { return nil, err } - for _, loadbalancer := range output.LoadBalancers { + for _, lb := range output.LoadBalancers { resources = append(resources, &LightsailLoadBalancer{ svc: svc, - loadBalancerName: loadbalancer.Name, + loadBalancerName: lb.Name, }) } @@ -43,8 +53,12 @@ func ListLightsailLoadBalancers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LightsailLoadBalancer) Remove() error { +type LightsailLoadBalancer struct { + svc *lightsail.Lightsail + loadBalancerName *string +} +func (f *LightsailLoadBalancer) Remove(_ context.Context) error { _, err := f.svc.DeleteLoadBalancer(&lightsail.DeleteLoadBalancerInput{ LoadBalancerName: f.loadBalancerName, }) diff --git a/resources/lightsail-staticips.go b/resources/lightsail-staticips.go index c7b1ac851..09147fc0d 100644 --- a/resources/lightsail-staticips.go +++ b/resources/lightsail-staticips.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/lightsail" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type LightsailStaticIP struct { - svc *lightsail.Lightsail - staticIPName *string -} +const LightsailStaticIPResource = "LightsailStaticIP" func init() { - register("LightsailStaticIP", ListLightsailStaticIPs) + resource.Register(resource.Registration{ + Name: LightsailStaticIPResource, + Scope: nuke.Account, + Lister: &LightsailStaticIPLister{}, + }) } -func ListLightsailStaticIPs(sess *session.Session) ([]Resource, error) { - svc := lightsail.New(sess) - resources := []Resource{} +type LightsailStaticIPLister struct{} + +func (l *LightsailStaticIPLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := lightsail.New(opts.Session) + resources := make([]resource.Resource, 0) params := &lightsail.GetStaticIpsInput{} @@ -43,8 +53,12 @@ func ListLightsailStaticIPs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *LightsailStaticIP) Remove() error { +type LightsailStaticIP struct { + svc *lightsail.Lightsail + staticIPName *string +} +func (f *LightsailStaticIP) Remove(_ context.Context) error { _, err := f.svc.ReleaseStaticIp(&lightsail.ReleaseStaticIpInput{ StaticIpName: f.staticIPName, }) diff --git a/resources/machinelearning-batchpredictions.go b/resources/machinelearning-batchpredictions.go index 46c9977b8..07d231b69 100644 --- a/resources/machinelearning-batchpredictions.go +++ b/resources/machinelearning-batchpredictions.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/machinelearning" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MachineLearningBranchPrediction struct { - svc *machinelearning.MachineLearning - ID *string -} +const MachineLearningBranchPredictionResource = "MachineLearningBranchPrediction" func init() { - register("MachineLearningBranchPrediction", ListMachineLearningBranchPredictions) + resource.Register(resource.Registration{ + Name: MachineLearningBranchPredictionResource, + Scope: nuke.Account, + Lister: &MachineLearningBranchPredictionLister{}, + }) } -func ListMachineLearningBranchPredictions(sess *session.Session) ([]Resource, error) { - svc := machinelearning.New(sess) - resources := []Resource{} +type MachineLearningBranchPredictionLister struct{} + +func (l *MachineLearningBranchPredictionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := machinelearning.New(opts.Session) + resources := make([]resource.Resource, 0) params := &machinelearning.DescribeBatchPredictionsInput{ Limit: aws.Int64(100), @@ -46,8 +56,12 @@ func ListMachineLearningBranchPredictions(sess *session.Session) ([]Resource, er return resources, nil } -func (f *MachineLearningBranchPrediction) Remove() error { +type MachineLearningBranchPrediction struct { + svc *machinelearning.MachineLearning + ID *string +} +func (f *MachineLearningBranchPrediction) Remove(_ context.Context) error { _, err := f.svc.DeleteBatchPrediction(&machinelearning.DeleteBatchPredictionInput{ BatchPredictionId: f.ID, }) diff --git a/resources/machinelearning-datasources.go b/resources/machinelearning-datasources.go index 3dfb84a46..300fc9484 100644 --- a/resources/machinelearning-datasources.go +++ b/resources/machinelearning-datasources.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/machinelearning" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MachineLearningDataSource struct { - svc *machinelearning.MachineLearning - ID *string -} +const MachineLearningDataSourceResource = "MachineLearningDataSource" func init() { - register("MachineLearningDataSource", ListMachineLearningDataSources) + resource.Register(resource.Registration{ + Name: MachineLearningDataSourceResource, + Scope: nuke.Account, + Lister: &MachineLearningDataSourceLister{}, + }) } -func ListMachineLearningDataSources(sess *session.Session) ([]Resource, error) { - svc := machinelearning.New(sess) - resources := []Resource{} +type MachineLearningDataSourceLister struct{} + +func (l *MachineLearningDataSourceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := machinelearning.New(opts.Session) + resources := make([]resource.Resource, 0) params := &machinelearning.DescribeDataSourcesInput{ Limit: aws.Int64(100), @@ -46,8 +56,12 @@ func ListMachineLearningDataSources(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MachineLearningDataSource) Remove() error { +type MachineLearningDataSource struct { + svc *machinelearning.MachineLearning + ID *string +} +func (f *MachineLearningDataSource) Remove(_ context.Context) error { _, err := f.svc.DeleteDataSource(&machinelearning.DeleteDataSourceInput{ DataSourceId: f.ID, }) diff --git a/resources/machinelearning-evaluations.go b/resources/machinelearning-evaluations.go index 6ef834089..ad1c754ca 100644 --- a/resources/machinelearning-evaluations.go +++ b/resources/machinelearning-evaluations.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/machinelearning" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MachineLearningEvaluation struct { - svc *machinelearning.MachineLearning - ID *string -} +const MachineLearningEvaluationResource = "MachineLearningEvaluation" func init() { - register("MachineLearningEvaluation", ListMachineLearningEvaluations) + resource.Register(resource.Registration{ + Name: MachineLearningEvaluationResource, + Scope: nuke.Account, + Lister: &MachineLearningEvaluationLister{}, + }) } -func ListMachineLearningEvaluations(sess *session.Session) ([]Resource, error) { - svc := machinelearning.New(sess) - resources := []Resource{} +type MachineLearningEvaluationLister struct{} + +func (l *MachineLearningEvaluationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := machinelearning.New(opts.Session) + resources := make([]resource.Resource, 0) params := &machinelearning.DescribeEvaluationsInput{ Limit: aws.Int64(100), @@ -46,8 +56,12 @@ func ListMachineLearningEvaluations(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MachineLearningEvaluation) Remove() error { +type MachineLearningEvaluation struct { + svc *machinelearning.MachineLearning + ID *string +} +func (f *MachineLearningEvaluation) Remove(_ context.Context) error { _, err := f.svc.DeleteEvaluation(&machinelearning.DeleteEvaluationInput{ EvaluationId: f.ID, }) diff --git a/resources/machinelearning-mlmodels.go b/resources/machinelearning-mlmodels.go index b223efd00..e1811e866 100644 --- a/resources/machinelearning-mlmodels.go +++ b/resources/machinelearning-mlmodels.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/machinelearning" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MachineLearningMLModel struct { - svc *machinelearning.MachineLearning - ID *string -} +const MachineLearningMLModelResource = "MachineLearningMLModel" func init() { - register("MachineLearningMLModel", ListMachineLearningMLModels) + resource.Register(resource.Registration{ + Name: MachineLearningMLModelResource, + Scope: nuke.Account, + Lister: &MachineLearningMLModelLister{}, + }) } -func ListMachineLearningMLModels(sess *session.Session) ([]Resource, error) { - svc := machinelearning.New(sess) - resources := []Resource{} +type MachineLearningMLModelLister struct{} + +func (l *MachineLearningMLModelLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := machinelearning.New(opts.Session) + resources := make([]resource.Resource, 0) params := &machinelearning.DescribeMLModelsInput{ Limit: aws.Int64(100), @@ -46,8 +56,12 @@ func ListMachineLearningMLModels(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MachineLearningMLModel) Remove() error { +type MachineLearningMLModel struct { + svc *machinelearning.MachineLearning + ID *string +} +func (f *MachineLearningMLModel) Remove(_ context.Context) error { _, err := f.svc.DeleteMLModel(&machinelearning.DeleteMLModelInput{ MLModelId: f.ID, }) diff --git a/resources/macie2.go b/resources/macie2.go index 57307ba4c..f64f4c220 100644 --- a/resources/macie2.go +++ b/resources/macie2.go @@ -1,20 +1,31 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/macie2" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type Macie struct { - svc *macie2.Macie2 -} +const MacieResource = "Macie" func init() { - register("Macie", CheckMacieStatus) + resource.Register(resource.Registration{ + Name: MacieResource, + Scope: nuke.Account, + Lister: &MacieLister{}, + }) } -func CheckMacieStatus(sess *session.Session) ([]Resource, error) { - svc := macie2.New(sess) +type MacieLister struct{} + +func (l *MacieLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := macie2.New(opts.Session) status, err := svc.GetMacieSession(&macie2.GetMacieSessionInput{}) if err != nil { @@ -25,7 +36,7 @@ func CheckMacieStatus(sess *session.Session) ([]Resource, error) { } } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) if *status.Status == macie2.AdminStatusEnabled { resources = append(resources, &Macie{ svc: svc, @@ -35,7 +46,11 @@ func CheckMacieStatus(sess *session.Session) ([]Resource, error) { return resources, nil } -func (b *Macie) Remove() error { +type Macie struct { + svc *macie2.Macie2 +} + +func (b *Macie) Remove(_ context.Context) error { _, err := b.svc.DisableMacie(&macie2.DisableMacieInput{}) if err != nil { return err diff --git a/resources/managedgrafana-workspaces.go b/resources/managedgrafana-workspaces.go index f44e58c48..8a6872e25 100644 --- a/resources/managedgrafana-workspaces.go +++ b/resources/managedgrafana-workspaces.go @@ -1,24 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/managedgrafana" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AMGWorkspace struct { - svc *managedgrafana.ManagedGrafana - id *string - name *string -} +const AMGWorkspaceResource = "AMGWorkspace" func init() { - register("AMGWorkspace", ListAMGWorkspaces) + resource.Register(resource.Registration{ + Name: AMGWorkspaceResource, + Scope: nuke.Account, + Lister: &AMGWorkspaceLister{}, + }) } -func ListAMGWorkspaces(sess *session.Session) ([]Resource, error) { - svc := managedgrafana.New(sess) - resources := []Resource{} +type AMGWorkspaceLister struct{} + +func (l *AMGWorkspaceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := managedgrafana.New(opts.Session) + resources := make([]resource.Resource, 0) var amgWorkspaces []*managedgrafana.WorkspaceSummary err := svc.ListWorkspacesPages( @@ -43,7 +52,13 @@ func ListAMGWorkspaces(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AMGWorkspace) Remove() error { +type AMGWorkspace struct { + svc *managedgrafana.ManagedGrafana + id *string + name *string +} + +func (f *AMGWorkspace) Remove(_ context.Context) error { _, err := f.svc.DeleteWorkspace(&managedgrafana.DeleteWorkspaceInput{ WorkspaceId: f.id, }) diff --git a/resources/mediaconvert-jobtemplates.go b/resources/mediaconvert-jobtemplates.go index 6c2ad41b2..fa3583c6f 100644 --- a/resources/mediaconvert-jobtemplates.go +++ b/resources/mediaconvert-jobtemplates.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediaconvert" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaConvertJobTemplate struct { - svc *mediaconvert.MediaConvert - name *string -} +const MediaConvertJobTemplateResource = "MediaConvertJobTemplate" func init() { - register("MediaConvertJobTemplate", ListMediaConvertJobTemplates) + resource.Register(resource.Registration{ + Name: MediaConvertJobTemplateResource, + Scope: nuke.Account, + Lister: &MediaConvertJobTemplateLister{}, + }) } -func ListMediaConvertJobTemplates(sess *session.Session) ([]Resource, error) { - svc := mediaconvert.New(sess) - resources := []Resource{} +type MediaConvertJobTemplateLister struct{} + +func (l *MediaConvertJobTemplateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mediaconvert.New(opts.Session) + resources := make([]resource.Resource, 0) var mediaEndpoint *string output, err := svc.DescribeEndpoints(&mediaconvert.DescribeEndpointsInput{}) @@ -25,8 +35,8 @@ func ListMediaConvertJobTemplates(sess *session.Session) ([]Resource, error) { return nil, err } - for _, mediaconvert := range output.Endpoints { - mediaEndpoint = mediaconvert.Url + for _, endpoint := range output.Endpoints { + mediaEndpoint = endpoint.Url } // Update svc to use custom media endpoint @@ -59,8 +69,12 @@ func ListMediaConvertJobTemplates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaConvertJobTemplate) Remove() error { +type MediaConvertJobTemplate struct { + svc *mediaconvert.MediaConvert + name *string +} +func (f *MediaConvertJobTemplate) Remove(_ context.Context) error { _, err := f.svc.DeleteJobTemplate(&mediaconvert.DeleteJobTemplateInput{ Name: f.name, }) diff --git a/resources/mediaconvert-presets.go b/resources/mediaconvert-presets.go index 1df4d84de..4dc8bfa75 100644 --- a/resources/mediaconvert-presets.go +++ b/resources/mediaconvert-presets.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediaconvert" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaConvertPreset struct { - svc *mediaconvert.MediaConvert - name *string -} +const MediaConvertPresetResource = "MediaConvertPreset" func init() { - register("MediaConvertPreset", ListMediaConvertPresets) + resource.Register(resource.Registration{ + Name: MediaConvertPresetResource, + Scope: nuke.Account, + Lister: &MediaConvertPresetLister{}, + }) } -func ListMediaConvertPresets(sess *session.Session) ([]Resource, error) { - svc := mediaconvert.New(sess) - resources := []Resource{} +type MediaConvertPresetLister struct{} + +func (l *MediaConvertPresetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mediaconvert.New(opts.Session) + resources := make([]resource.Resource, 0) var mediaEndpoint *string output, err := svc.DescribeEndpoints(&mediaconvert.DescribeEndpointsInput{}) @@ -25,8 +35,8 @@ func ListMediaConvertPresets(sess *session.Session) ([]Resource, error) { return nil, err } - for _, mediaconvert := range output.Endpoints { - mediaEndpoint = mediaconvert.Url + for _, endpoint := range output.Endpoints { + mediaEndpoint = endpoint.Url } // Update svc to use custom media endpoint @@ -59,8 +69,12 @@ func ListMediaConvertPresets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaConvertPreset) Remove() error { +type MediaConvertPreset struct { + svc *mediaconvert.MediaConvert + name *string +} +func (f *MediaConvertPreset) Remove(_ context.Context) error { _, err := f.svc.DeletePreset(&mediaconvert.DeletePresetInput{ Name: f.name, }) diff --git a/resources/mediaconvert-queues.go b/resources/mediaconvert-queues.go index ed9e20531..06ff15f8b 100644 --- a/resources/mediaconvert-queues.go +++ b/resources/mediaconvert-queues.go @@ -1,26 +1,36 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediaconvert" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaConvertQueue struct { - svc *mediaconvert.MediaConvert - name *string -} +const MediaConvertQueueResource = "MediaConvertQueue" func init() { - register("MediaConvertQueue", ListMediaConvertQueues) + resource.Register(resource.Registration{ + Name: MediaConvertQueueResource, + Scope: nuke.Account, + Lister: &MediaConvertQueueLister{}, + }) } -func ListMediaConvertQueues(sess *session.Session) ([]Resource, error) { - svc := mediaconvert.New(sess) - resources := []Resource{} +type MediaConvertQueueLister struct{} + +func (l *MediaConvertQueueLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mediaconvert.New(opts.Session) + resources := make([]resource.Resource, 0) var mediaEndpoint *string output, err := svc.DescribeEndpoints(&mediaconvert.DescribeEndpointsInput{}) @@ -28,8 +38,8 @@ func ListMediaConvertQueues(sess *session.Session) ([]Resource, error) { return nil, err } - for _, mediaconvert := range output.Endpoints { - mediaEndpoint = mediaconvert.Url + for _, endpoint := range output.Endpoints { + mediaEndpoint = endpoint.Url } // Update svc to use custom media endpoint @@ -62,8 +72,12 @@ func ListMediaConvertQueues(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaConvertQueue) Remove() error { +type MediaConvertQueue struct { + svc *mediaconvert.MediaConvert + name *string +} +func (f *MediaConvertQueue) Remove(_ context.Context) error { _, err := f.svc.DeleteQueue(&mediaconvert.DeleteQueueInput{ Name: f.name, }) diff --git a/resources/medialive-channels.go b/resources/medialive-channels.go index b9ba31727..f50f8ed41 100644 --- a/resources/medialive-channels.go +++ b/resources/medialive-channels.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/medialive" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaLiveChannel struct { - svc *medialive.MediaLive - ID *string -} +const MediaLiveChannelResource = "MediaLiveChannel" func init() { - register("MediaLiveChannel", ListMediaLiveChannels) + resource.Register(resource.Registration{ + Name: MediaLiveChannelResource, + Scope: nuke.Account, + Lister: &MediaLiveChannelLister{}, + }) } -func ListMediaLiveChannels(sess *session.Session) ([]Resource, error) { - svc := medialive.New(sess) - resources := []Resource{} +type MediaLiveChannelLister struct{} + +func (l *MediaLiveChannelLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := medialive.New(opts.Session) + resources := make([]resource.Resource, 0) params := &medialive.ListChannelsInput{ MaxResults: aws.Int64(20), @@ -46,8 +56,12 @@ func ListMediaLiveChannels(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaLiveChannel) Remove() error { +type MediaLiveChannel struct { + svc *medialive.MediaLive + ID *string +} +func (f *MediaLiveChannel) Remove(_ context.Context) error { _, err := f.svc.DeleteChannel(&medialive.DeleteChannelInput{ ChannelId: f.ID, }) diff --git a/resources/medialive-inputs.go b/resources/medialive-inputs.go index d96664b9a..7e46c3167 100644 --- a/resources/medialive-inputs.go +++ b/resources/medialive-inputs.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/medialive" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaLiveInput struct { - svc *medialive.MediaLive - ID *string -} +const MediaLiveInputResource = "MediaLiveInput" func init() { - register("MediaLiveInput", ListMediaLiveInputs) + resource.Register(resource.Registration{ + Name: MediaLiveInputResource, + Scope: nuke.Account, + Lister: &MediaLiveInputLister{}, + }) } -func ListMediaLiveInputs(sess *session.Session) ([]Resource, error) { - svc := medialive.New(sess) - resources := []Resource{} +type MediaLiveInputLister struct{} + +func (l *MediaLiveInputLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := medialive.New(opts.Session) + resources := make([]resource.Resource, 0) params := &medialive.ListInputsInput{ MaxResults: aws.Int64(20), @@ -46,8 +56,12 @@ func ListMediaLiveInputs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaLiveInput) Remove() error { +type MediaLiveInput struct { + svc *medialive.MediaLive + ID *string +} +func (f *MediaLiveInput) Remove(_ context.Context) error { _, err := f.svc.DeleteInput(&medialive.DeleteInputInput{ InputId: f.ID, }) diff --git a/resources/medialive-inputsecuritygroups.go b/resources/medialive-inputsecuritygroups.go index 0e62a66ab..4293609b1 100644 --- a/resources/medialive-inputsecuritygroups.go +++ b/resources/medialive-inputsecuritygroups.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/medialive" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaLiveInputSecurityGroup struct { - svc *medialive.MediaLive - ID *string -} +const MediaLiveInputSecurityGroupResource = "MediaLiveInputSecurityGroup" func init() { - register("MediaLiveInputSecurityGroup", ListMediaLiveInputSecurityGroups) + resource.Register(resource.Registration{ + Name: MediaLiveInputSecurityGroupResource, + Scope: nuke.Account, + Lister: &MediaLiveInputSecurityGroupLister{}, + }) } -func ListMediaLiveInputSecurityGroups(sess *session.Session) ([]Resource, error) { - svc := medialive.New(sess) - resources := []Resource{} +type MediaLiveInputSecurityGroupLister struct{} + +func (l *MediaLiveInputSecurityGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := medialive.New(opts.Session) + resources := make([]resource.Resource, 0) params := &medialive.ListInputSecurityGroupsInput{ MaxResults: aws.Int64(20), @@ -46,8 +56,12 @@ func ListMediaLiveInputSecurityGroups(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *MediaLiveInputSecurityGroup) Remove() error { +type MediaLiveInputSecurityGroup struct { + svc *medialive.MediaLive + ID *string +} +func (f *MediaLiveInputSecurityGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteInputSecurityGroup(&medialive.DeleteInputSecurityGroupInput{ InputSecurityGroupId: f.ID, }) diff --git a/resources/mediapackage-channels.go b/resources/mediapackage-channels.go index c27b23145..1a9f7524c 100644 --- a/resources/mediapackage-channels.go +++ b/resources/mediapackage-channels.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediapackage" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaPackageChannel struct { - svc *mediapackage.MediaPackage - ID *string -} +const MediaPackageChannelResource = "MediaPackageChannel" func init() { - register("MediaPackageChannel", ListMediaPackageChannels) + resource.Register(resource.Registration{ + Name: MediaPackageChannelResource, + Scope: nuke.Account, + Lister: &MediaPackageChannelLister{}, + }) } -func ListMediaPackageChannels(sess *session.Session) ([]Resource, error) { - svc := mediapackage.New(sess) - resources := []Resource{} +type MediaPackageChannelLister struct{} + +func (l *MediaPackageChannelLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mediapackage.New(opts.Session) + resources := make([]resource.Resource, 0) params := &mediapackage.ListChannelsInput{ MaxResults: aws.Int64(50), @@ -46,8 +56,12 @@ func ListMediaPackageChannels(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaPackageChannel) Remove() error { +type MediaPackageChannel struct { + svc *mediapackage.MediaPackage + ID *string +} +func (f *MediaPackageChannel) Remove(_ context.Context) error { _, err := f.svc.DeleteChannel(&mediapackage.DeleteChannelInput{ Id: f.ID, }) diff --git a/resources/mediapackage-originendpoints.go b/resources/mediapackage-originendpoints.go index fcf58fbc7..2be2cc5bc 100644 --- a/resources/mediapackage-originendpoints.go +++ b/resources/mediapackage-originendpoints.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediapackage" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaPackageOriginEndpoint struct { - svc *mediapackage.MediaPackage - ID *string -} +const MediaPackageOriginEndpointResource = "MediaPackageOriginEndpoint" func init() { - register("MediaPackageOriginEndpoint", ListMediaPackageOriginEndpoints) + resource.Register(resource.Registration{ + Name: MediaPackageOriginEndpointResource, + Scope: nuke.Account, + Lister: &MediaPackageOriginEndpointLister{}, + }) } -func ListMediaPackageOriginEndpoints(sess *session.Session) ([]Resource, error) { - svc := mediapackage.New(sess) - resources := []Resource{} +type MediaPackageOriginEndpointLister struct{} + +func (l *MediaPackageOriginEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mediapackage.New(opts.Session) + resources := make([]resource.Resource, 0) params := &mediapackage.ListOriginEndpointsInput{ MaxResults: aws.Int64(50), @@ -46,8 +56,12 @@ func ListMediaPackageOriginEndpoints(sess *session.Session) ([]Resource, error) return resources, nil } -func (f *MediaPackageOriginEndpoint) Remove() error { +type MediaPackageOriginEndpoint struct { + svc *mediapackage.MediaPackage + ID *string +} +func (f *MediaPackageOriginEndpoint) Remove(_ context.Context) error { _, err := f.svc.DeleteOriginEndpoint(&mediapackage.DeleteOriginEndpointInput{ Id: f.ID, }) diff --git a/resources/mediastore-containers.go b/resources/mediastore-containers.go index 8ccd4f9c8..ad955bf7e 100644 --- a/resources/mediastore-containers.go +++ b/resources/mediastore-containers.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediastore" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaStoreContainer struct { - svc *mediastore.MediaStore - name *string -} +const MediaStoreContainerResource = "MediaStoreContainer" func init() { - register("MediaStoreContainer", ListMediaStoreContainers) + resource.Register(resource.Registration{ + Name: MediaStoreContainerResource, + Scope: nuke.Account, + Lister: &MediaStoreContainerLister{}, + }) } -func ListMediaStoreContainers(sess *session.Session) ([]Resource, error) { - svc := mediastore.New(sess) - resources := []Resource{} +type MediaStoreContainerLister struct{} + +func (l *MediaStoreContainerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mediastore.New(opts.Session) + resources := make([]resource.Resource, 0) params := &mediastore.ListContainersInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListMediaStoreContainers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaStoreContainer) Remove() error { +type MediaStoreContainer struct { + svc *mediastore.MediaStore + name *string +} +func (f *MediaStoreContainer) Remove(_ context.Context) error { _, err := f.svc.DeleteContainer(&mediastore.DeleteContainerInput{ ContainerName: f.name, }) diff --git a/resources/mediastoredata-items.go b/resources/mediastoredata-items.go index 0a7bc9aa1..6ffaffd9a 100644 --- a/resources/mediastoredata-items.go +++ b/resources/mediastoredata-items.go @@ -1,27 +1,38 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediastore" "github.com/aws/aws-sdk-go/service/mediastoredata" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaStoreDataItems struct { - svc *mediastoredata.MediaStoreData - path *string -} +const MediaStoreDataItemsResource = "MediaStoreDataItems" func init() { - register("MediaStoreDataItems", ListMediaStoreDataItems) + resource.Register(resource.Registration{ + Name: MediaStoreDataItemsResource, + Scope: nuke.Account, + Lister: &MediaStoreDataItemsLister{}, + }) } -func ListMediaStoreDataItems(sess *session.Session) ([]Resource, error) { - containerSvc := mediastore.New(sess) - svc := mediastoredata.New(sess) +type MediaStoreDataItemsLister struct{} + +func (l *MediaStoreDataItemsLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + containerSvc := mediastore.New(opts.Session) + svc := mediastoredata.New(opts.Session) svc.ClientInfo.SigningName = "mediastore" - resources := []Resource{} - containers := []*mediastore.Container{} + + resources := make([]resource.Resource, 0) + var containers []*mediastore.Container //List all containers containerParams := &mediastore.ListContainersInput{ @@ -77,8 +88,12 @@ func ListMediaStoreDataItems(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaStoreDataItems) Remove() error { +type MediaStoreDataItems struct { + svc *mediastoredata.MediaStoreData + path *string +} +func (f *MediaStoreDataItems) Remove(_ context.Context) error { _, err := f.svc.DeleteObject(&mediastoredata.DeleteObjectInput{ Path: f.path, }) diff --git a/resources/mediatailor-configurations.go b/resources/mediatailor-configurations.go index 6415cd35b..84ed414e2 100644 --- a/resources/mediatailor-configurations.go +++ b/resources/mediatailor-configurations.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mediatailor" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MediaTailorConfiguration struct { - svc *mediatailor.MediaTailor - name *string -} +const MediaTailorConfigurationResource = "MediaTailorConfiguration" func init() { - register("MediaTailorConfiguration", ListMediaTailorConfigurations) + resource.Register(resource.Registration{ + Name: MediaTailorConfigurationResource, + Scope: nuke.Account, + Lister: &MediaTailorConfigurationLister{}, + }) } -func ListMediaTailorConfigurations(sess *session.Session) ([]Resource, error) { - svc := mediatailor.New(sess) - resources := []Resource{} +type MediaTailorConfigurationLister struct{} + +func (l *MediaTailorConfigurationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mediatailor.New(opts.Session) + resources := make([]resource.Resource, 0) params := &mediatailor.ListPlaybackConfigurationsInput{ MaxResults: aws.Int64(100), @@ -44,8 +54,12 @@ func ListMediaTailorConfigurations(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MediaTailorConfiguration) Remove() error { +type MediaTailorConfiguration struct { + svc *mediatailor.MediaTailor + name *string +} +func (f *MediaTailorConfiguration) Remove(_ context.Context) error { _, err := f.svc.DeletePlaybackConfiguration(&mediatailor.DeletePlaybackConfigurationInput{ Name: f.name, }) diff --git a/resources/mgn-jobs.go b/resources/mgn-jobs.go index 2159b3c55..87581c8fb 100644 --- a/resources/mgn-jobs.go +++ b/resources/mgn-jobs.go @@ -1,26 +1,36 @@ package resources import ( + "context" + + "errors" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/mgn" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MGNJob struct { - svc *mgn.Mgn - jobID *string - arn *string - tags map[string]*string -} +const MGNJobResource = "MGNJob" func init() { - register("MGNJob", ListMGNJobs) + resource.Register(resource.Registration{ + Name: MGNJobResource, + Scope: nuke.Account, + Lister: &MGNJobLister{}, + }) } -func ListMGNJobs(sess *session.Session) ([]Resource, error) { - svc := mgn.New(sess) - resources := []Resource{} +type MGNJobLister struct{} + +func (l *MGNJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mgn.New(opts.Session) + resources := make([]resource.Resource, 0) params := &mgn.DescribeJobsInput{ MaxResults: aws.Int64(50), @@ -29,6 +39,12 @@ func ListMGNJobs(sess *session.Session) ([]Resource, error) { for { output, err := svc.DescribeJobs(params) if err != nil { + var awsErr awserr.Error + ok := errors.As(err, &awsErr) + if ok && awsErr.Code() == "UninitializedAccountException" { + return nil, nil + } + return nil, err } @@ -51,8 +67,14 @@ func ListMGNJobs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MGNJob) Remove() error { +type MGNJob struct { + svc *mgn.Mgn + jobID *string + arn *string + tags map[string]*string +} +func (f *MGNJob) Remove(_ context.Context) error { _, err := f.svc.DeleteJob(&mgn.DeleteJobInput{ JobID: f.jobID, }) @@ -68,6 +90,7 @@ func (f *MGNJob) Properties() types.Properties { for key, val := range f.tags { properties.SetTag(&key, val) } + return properties } diff --git a/resources/mgn-source_servers.go b/resources/mgn-source-servers.go similarity index 60% rename from resources/mgn-source_servers.go rename to resources/mgn-source-servers.go index 706138a77..e26072a88 100644 --- a/resources/mgn-source_servers.go +++ b/resources/mgn-source-servers.go @@ -1,26 +1,36 @@ package resources import ( + "context" + + "errors" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/mgn" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MGNSourceServer struct { - svc *mgn.Mgn - sourceServerID *string - arn *string - tags map[string]*string -} +const MGNSourceServerResource = "MGNSourceServer" func init() { - register("MGNSourceServer", ListMGNSourceServers) + resource.Register(resource.Registration{ + Name: MGNSourceServerResource, + Scope: nuke.Account, + Lister: &MGNSourceServerLister{}, + }) } -func ListMGNSourceServers(sess *session.Session) ([]Resource, error) { - svc := mgn.New(sess) - resources := []Resource{} +type MGNSourceServerLister struct{} + +func (l *MGNSourceServerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mgn.New(opts.Session) + resources := make([]resource.Resource, 0) params := &mgn.DescribeSourceServersInput{ MaxResults: aws.Int64(50), @@ -29,6 +39,12 @@ func ListMGNSourceServers(sess *session.Session) ([]Resource, error) { for { output, err := svc.DescribeSourceServers(params) if err != nil { + var awsErr awserr.Error + ok := errors.As(err, &awsErr) + if ok && awsErr.Code() == "UninitializedAccountException" { + return nil, nil + } + return nil, err } @@ -51,8 +67,14 @@ func ListMGNSourceServers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MGNSourceServer) Remove() error { +type MGNSourceServer struct { + svc *mgn.Mgn + sourceServerID *string + arn *string + tags map[string]*string +} +func (f *MGNSourceServer) Remove(_ context.Context) error { _, err := f.svc.DeleteSourceServer(&mgn.DeleteSourceServerInput{ SourceServerID: f.sourceServerID, }) @@ -68,6 +90,7 @@ func (f *MGNSourceServer) Properties() types.Properties { for key, val := range f.tags { properties.SetTag(&key, val) } + return properties } diff --git a/resources/mobile-projects.go b/resources/mobile-projects.go index 21ca3ae36..f94116810 100644 --- a/resources/mobile-projects.go +++ b/resources/mobile-projects.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mobile" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MobileProject struct { - svc *mobile.Mobile - projectID *string -} +const MobileProjectResource = "MobileProject" func init() { - register("MobileProject", ListMobileProjects) + resource.Register(resource.Registration{ + Name: MobileProjectResource, + Scope: nuke.Account, + Lister: &MobileProjectLister{}, + }) } -func ListMobileProjects(sess *session.Session) ([]Resource, error) { - svc := mobile.New(sess) +type MobileProjectLister struct{} + +func (l *MobileProjectLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mobile.New(opts.Session) svc.ClientInfo.SigningName = "AWSMobileHubService" - resources := []Resource{} + resources := make([]resource.Resource, 0) params := &mobile.ListProjectsInput{ MaxResults: aws.Int64(100), @@ -47,8 +57,12 @@ func ListMobileProjects(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MobileProject) Remove() error { +type MobileProject struct { + svc *mobile.Mobile + projectID *string +} +func (f *MobileProject) Remove(_ context.Context) error { _, err := f.svc.DeleteProject(&mobile.DeleteProjectInput{ ProjectId: f.projectID, }) diff --git a/resources/mq-broker.go b/resources/mq-broker.go index ac972a280..4e81da0a4 100644 --- a/resources/mq-broker.go +++ b/resources/mq-broker.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/mq" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MQBroker struct { - svc *mq.MQ - brokerID *string -} +const MQBrokerResource = "MQBroker" func init() { - register("MQBroker", ListMQBrokers) + resource.Register(resource.Registration{ + Name: MQBrokerResource, + Scope: nuke.Account, + Lister: &MQBrokerLister{}, + }) } -func ListMQBrokers(sess *session.Session) ([]Resource, error) { - svc := mq.New(sess) - resources := []Resource{} +type MQBrokerLister struct{} + +func (l *MQBrokerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := mq.New(opts.Session) + resources := make([]resource.Resource, 0) params := &mq.ListBrokersInput{ MaxResults: aws.Int64(100), @@ -44,8 +54,12 @@ func ListMQBrokers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *MQBroker) Remove() error { +type MQBroker struct { + svc *mq.MQ + brokerID *string +} +func (f *MQBroker) Remove(_ context.Context) error { _, err := f.svc.DeleteBroker(&mq.DeleteBrokerInput{ BrokerId: f.brokerID, }) diff --git a/resources/msk-cluster.go b/resources/msk-cluster.go index 4c3be6c3e..44827f052 100644 --- a/resources/msk-cluster.go +++ b/resources/msk-cluster.go @@ -1,32 +1,40 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/kafka" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MSKCluster struct { - svc *kafka.Kafka - arn string - name string - tags map[string]*string -} +const MSKClusterResource = "MSKCluster" func init() { - register("MSKCluster", ListMSKCluster) + resource.Register(resource.Registration{ + Name: MSKClusterResource, + Scope: nuke.Account, + Lister: &MSKClusterLister{}, + }) } -func ListMSKCluster(sess *session.Session) ([]Resource, error) { - svc := kafka.New(sess) +type MSKClusterLister struct{} + +func (l *MSKClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kafka.New(opts.Session) params := &kafka.ListClustersInput{} resp, err := svc.ListClusters(params) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, cluster := range resp.ClusterInfoList { resources = append(resources, &MSKCluster{ svc: svc, @@ -39,7 +47,14 @@ func ListMSKCluster(sess *session.Session) ([]Resource, error) { return resources, nil } -func (m *MSKCluster) Remove() error { +type MSKCluster struct { + svc *kafka.Kafka + arn string + name string + tags map[string]*string +} + +func (m *MSKCluster) Remove(_ context.Context) error { params := &kafka.DeleteClusterInput{ ClusterArn: &m.arn, } diff --git a/resources/msk-configuration.go b/resources/msk-configuration.go index 97095b850..0944d586a 100644 --- a/resources/msk-configuration.go +++ b/resources/msk-configuration.go @@ -1,30 +1,39 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/kafka" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type MSKConfiguration struct { - svc *kafka.Kafka - arn string - name string -} +const MSKConfigurationResource = "MSKConfiguration" func init() { - register("MSKConfiguration", ListMSKConfigurations) + resource.Register(resource.Registration{ + Name: MSKConfigurationResource, + Scope: nuke.Account, + Lister: &MSKConfigurationLister{}, + }) } -func ListMSKConfigurations(sess *session.Session) ([]Resource, error) { - svc := kafka.New(sess) +type MSKConfigurationLister struct{} + +func (l *MSKConfigurationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := kafka.New(opts.Session) params := &kafka.ListConfigurationsInput{} resp, err := svc.ListConfigurations(params) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, configuration := range resp.Configurations { resources = append(resources, &MSKConfiguration{ svc: svc, @@ -36,7 +45,13 @@ func ListMSKConfigurations(sess *session.Session) ([]Resource, error) { return resources, nil } -func (m *MSKConfiguration) Remove() error { +type MSKConfiguration struct { + svc *kafka.Kafka + arn string + name string +} + +func (m *MSKConfiguration) Remove(_ context.Context) error { params := &kafka.DeleteConfigurationInput{ Arn: &m.arn, } diff --git a/resources/neptune-clusters.go b/resources/neptune-clusters.go index bda38efa1..b0fbd2980 100644 --- a/resources/neptune-clusters.go +++ b/resources/neptune-clusters.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/neptune" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type NeptuneCluster struct { - svc *neptune.Neptune - ID *string -} +const NeptuneClusterResource = "NeptuneCluster" func init() { - register("NeptuneCluster", ListNeptuneClusters) + resource.Register(resource.Registration{ + Name: NeptuneClusterResource, + Scope: nuke.Account, + Lister: &NeptuneClusterLister{}, + }) } -func ListNeptuneClusters(sess *session.Session) ([]Resource, error) { - svc := neptune.New(sess) - resources := []Resource{} +type NeptuneClusterLister struct{} + +func (l *NeptuneClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := neptune.New(opts.Session) + resources := make([]resource.Resource, 0) params := &neptune.DescribeDBClustersInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListNeptuneClusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *NeptuneCluster) Remove() error { +type NeptuneCluster struct { + svc *neptune.Neptune + ID *string +} +func (f *NeptuneCluster) Remove(_ context.Context) error { _, err := f.svc.DeleteDBCluster(&neptune.DeleteDBClusterInput{ DBClusterIdentifier: f.ID, SkipFinalSnapshot: aws.Bool(true), diff --git a/resources/neptune-instances.go b/resources/neptune-instances.go index d4797990a..20daeb4f9 100644 --- a/resources/neptune-instances.go +++ b/resources/neptune-instances.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/neptune" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type NeptuneInstance struct { - svc *neptune.Neptune - ID *string -} +const NeptuneInstanceResource = "NeptuneInstance" func init() { - register("NeptuneInstance", ListNeptuneInstances) + resource.Register(resource.Registration{ + Name: NeptuneInstanceResource, + Scope: nuke.Account, + Lister: &NeptuneInstanceLister{}, + }) } -func ListNeptuneInstances(sess *session.Session) ([]Resource, error) { - svc := neptune.New(sess) - resources := []Resource{} +type NeptuneInstanceLister struct{} + +func (l *NeptuneInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := neptune.New(opts.Session) + resources := make([]resource.Resource, 0) params := &neptune.DescribeDBInstancesInput{ MaxRecords: aws.Int64(100), @@ -46,8 +56,12 @@ func ListNeptuneInstances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *NeptuneInstance) Remove() error { +type NeptuneInstance struct { + svc *neptune.Neptune + ID *string +} +func (f *NeptuneInstance) Remove(_ context.Context) error { _, err := f.svc.DeleteDBInstance(&neptune.DeleteDBInstanceInput{ DBInstanceIdentifier: f.ID, SkipFinalSnapshot: aws.Bool(true), diff --git a/resources/neptune-snapshots.go b/resources/neptune-snapshots.go index 5ec8b1e0b..348683a57 100644 --- a/resources/neptune-snapshots.go +++ b/resources/neptune-snapshots.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/neptune" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type NetpuneSnapshot struct { - svc *neptune.Neptune - ID *string -} +const NeptuneSnapshotResource = "NeptuneSnapshot" func init() { - register("NetpuneSnapshot", ListNetpuneSnapshots) + resource.Register(resource.Registration{ + Name: NeptuneSnapshotResource, + Scope: nuke.Account, + Lister: &NeptuneSnapshotLister{}, + }) } -func ListNetpuneSnapshots(sess *session.Session) ([]Resource, error) { - svc := neptune.New(sess) - resources := []Resource{} +type NeptuneSnapshotLister struct{} + +func (l *NeptuneSnapshotLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := neptune.New(opts.Session) + resources := make([]resource.Resource, 0) params := &neptune.DescribeDBClusterSnapshotsInput{ MaxRecords: aws.Int64(100), @@ -30,7 +40,7 @@ func ListNetpuneSnapshots(sess *session.Session) ([]Resource, error) { } for _, dbClusterSnapshot := range output.DBClusterSnapshots { - resources = append(resources, &NetpuneSnapshot{ + resources = append(resources, &NeptuneSnapshot{ svc: svc, ID: dbClusterSnapshot.DBClusterSnapshotIdentifier, }) @@ -46,8 +56,12 @@ func ListNetpuneSnapshots(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *NetpuneSnapshot) Remove() error { +type NeptuneSnapshot struct { + svc *neptune.Neptune + ID *string +} +func (f *NeptuneSnapshot) Remove(_ context.Context) error { _, err := f.svc.DeleteDBClusterSnapshot(&neptune.DeleteDBClusterSnapshotInput{ DBClusterSnapshotIdentifier: f.ID, }) @@ -55,6 +69,6 @@ func (f *NetpuneSnapshot) Remove() error { return err } -func (f *NetpuneSnapshot) String() string { +func (f *NeptuneSnapshot) String() string { return *f.ID } diff --git a/resources/opensearchservice-domain.go b/resources/opensearchservice-domain.go index 4781d7ac7..7d77fd621 100644 --- a/resources/opensearchservice-domain.go +++ b/resources/opensearchservice-domain.go @@ -1,26 +1,34 @@ package resources import ( + "context" + "time" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/opensearchservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OSDomain struct { - svc *opensearchservice.OpenSearchService - domainName *string - lastUpdatedTime *time.Time - tagList []*opensearchservice.Tag -} +const OSDomainResource = "OSDomain" func init() { - register("OSDomain", ListOSDomains) + resource.Register(resource.Registration{ + Name: OSDomainResource, + Scope: nuke.Account, + Lister: &OSDomainLister{}, + }) } -func ListOSDomains(sess *session.Session) ([]Resource, error) { - svc := opensearchservice.New(sess) +type OSDomainLister struct{} + +func (l *OSDomainLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opensearchservice.New(opts.Session) listResp, err := svc.ListDomainNames(&opensearchservice.ListDomainNamesInput{}) if err != nil { @@ -31,7 +39,7 @@ func ListOSDomains(sess *session.Session) ([]Resource, error) { domainNames = append(domainNames, domain.DomainName) } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) // early return to prevent the `missing required field, DescribeDomainsInput.DomainNames.` error if len(domainNames) == 0 { @@ -68,7 +76,14 @@ func ListOSDomains(sess *session.Session) ([]Resource, error) { return resources, nil } -func (o *OSDomain) Remove() error { +type OSDomain struct { + svc *opensearchservice.OpenSearchService + domainName *string + lastUpdatedTime *time.Time + tagList []*opensearchservice.Tag +} + +func (o *OSDomain) Remove(_ context.Context) error { _, err := o.svc.DeleteDomain(&opensearchservice.DeleteDomainInput{ DomainName: o.domainName, }) diff --git a/resources/opsworks-apps.go b/resources/opsworks-apps.go index 4f784fad5..4502c0337 100644 --- a/resources/opsworks-apps.go +++ b/resources/opsworks-apps.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/opsworks" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OpsWorksApp struct { - svc *opsworks.OpsWorks - ID *string -} +const OpsWorksAppResource = "OpsWorksApp" func init() { - register("OpsWorksApp", ListOpsWorksApps) + resource.Register(resource.Registration{ + Name: OpsWorksAppResource, + Scope: nuke.Account, + Lister: &OpsWorksAppLister{}, + }) } -func ListOpsWorksApps(sess *session.Session) ([]Resource, error) { - svc := opsworks.New(sess) - resources := []Resource{} +type OpsWorksAppLister struct{} + +func (l *OpsWorksAppLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opsworks.New(opts.Session) + resources := make([]resource.Resource, 0) stackParams := &opsworks.DescribeStacksInput{} @@ -45,8 +55,12 @@ func ListOpsWorksApps(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *OpsWorksApp) Remove() error { +type OpsWorksApp struct { + svc *opsworks.OpsWorks + ID *string +} +func (f *OpsWorksApp) Remove(_ context.Context) error { _, err := f.svc.DeleteApp(&opsworks.DeleteAppInput{ AppId: f.ID, }) diff --git a/resources/opsworks-instances.go b/resources/opsworks-instances.go index c60e8df4f..97ea4f7bb 100644 --- a/resources/opsworks-instances.go +++ b/resources/opsworks-instances.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/opsworks" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OpsWorksInstance struct { - svc *opsworks.OpsWorks - ID *string -} +const OpsWorksInstanceResource = "OpsWorksInstance" func init() { - register("OpsWorksInstance", ListOpsWorksInstances) + resource.Register(resource.Registration{ + Name: OpsWorksInstanceResource, + Scope: nuke.Account, + Lister: &OpsWorksInstanceLister{}, + }) } -func ListOpsWorksInstances(sess *session.Session) ([]Resource, error) { - svc := opsworks.New(sess) - resources := []Resource{} +type OpsWorksInstanceLister struct{} + +func (l *OpsWorksInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opsworks.New(opts.Session) + resources := make([]resource.Resource, 0) stackParams := &opsworks.DescribeStacksInput{} @@ -44,8 +54,12 @@ func ListOpsWorksInstances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *OpsWorksInstance) Remove() error { +type OpsWorksInstance struct { + svc *opsworks.OpsWorks + ID *string +} +func (f *OpsWorksInstance) Remove(_ context.Context) error { _, err := f.svc.DeleteInstance(&opsworks.DeleteInstanceInput{ InstanceId: f.ID, }) diff --git a/resources/opsworks-layers.go b/resources/opsworks-layers.go index 078ce252a..9deeaa502 100644 --- a/resources/opsworks-layers.go +++ b/resources/opsworks-layers.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/opsworks" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OpsWorksLayer struct { - svc *opsworks.OpsWorks - ID *string -} +const OpsWorksLayerResource = "OpsWorksLayer" func init() { - register("OpsWorksLayer", ListOpsWorksLayers) + resource.Register(resource.Registration{ + Name: OpsWorksLayerResource, + Scope: nuke.Account, + Lister: &OpsWorksLayerLister{}, + }) } -func ListOpsWorksLayers(sess *session.Session) ([]Resource, error) { - svc := opsworks.New(sess) - resources := []Resource{} +type OpsWorksLayerLister struct{} + +func (l *OpsWorksLayerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opsworks.New(opts.Session) + resources := make([]resource.Resource, 0) stackParams := &opsworks.DescribeStacksInput{} @@ -45,8 +55,12 @@ func ListOpsWorksLayers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *OpsWorksLayer) Remove() error { +type OpsWorksLayer struct { + svc *opsworks.OpsWorks + ID *string +} +func (f *OpsWorksLayer) Remove(_ context.Context) error { _, err := f.svc.DeleteLayer(&opsworks.DeleteLayerInput{ LayerId: f.ID, }) diff --git a/resources/opsworks-userprofiles.go b/resources/opsworks-userprofiles.go index 54000a5e8..a5b4b18bd 100644 --- a/resources/opsworks-userprofiles.go +++ b/resources/opsworks-userprofiles.go @@ -1,28 +1,39 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/opsworks" "github.com/aws/aws-sdk-go/service/sts" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OpsWorksUserProfile struct { - svc *opsworks.OpsWorks - ARN *string - callingArn *string -} +const OpsWorksUserProfileResource = "OpsWorksUserProfile" func init() { - register("OpsWorksUserProfile", ListOpsWorksUserProfiles) + resource.Register(resource.Registration{ + Name: OpsWorksUserProfileResource, + Scope: nuke.Account, + Lister: &OpsWorksUserProfileLister{}, + }) } -func ListOpsWorksUserProfiles(sess *session.Session) ([]Resource, error) { - svc := opsworks.New(sess) - resources := []Resource{} +type OpsWorksUserProfileLister struct{} - identityOutput, err := sts.New(sess).GetCallerIdentity(nil) +func (l *OpsWorksUserProfileLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opsworks.New(opts.Session) + resources := make([]resource.Resource, 0) + + // TODO: pass in account information via ListerOpts to avoid additional calls. + + identityOutput, err := sts.New(opts.Session).GetCallerIdentity(nil) if err != nil { return nil, err } @@ -45,14 +56,20 @@ func ListOpsWorksUserProfiles(sess *session.Session) ([]Resource, error) { return resources, nil } +type OpsWorksUserProfile struct { + svc *opsworks.OpsWorks + ARN *string + callingArn *string +} + func (f *OpsWorksUserProfile) Filter() error { if *f.callingArn == *f.ARN { - return fmt.Errorf("Cannot delete OpsWorksUserProfile of calling User") + return fmt.Errorf("cannot delete OpsWorksUserProfile of calling User") } return nil } -func (f *OpsWorksUserProfile) Remove() error { +func (f *OpsWorksUserProfile) Remove(_ context.Context) error { _, err := f.svc.DeleteUserProfile(&opsworks.DeleteUserProfileInput{ IamUserArn: f.ARN, }) diff --git a/resources/opsworkscm-backups.go b/resources/opsworkscm-backups.go index c1ef69fd5..cdfeca6d3 100644 --- a/resources/opsworkscm-backups.go +++ b/resources/opsworkscm-backups.go @@ -1,22 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/opsworkscm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OpsWorksCMBackup struct { - svc *opsworkscm.OpsWorksCM - ID *string -} +const OpsWorksCMBackupResource = "OpsWorksCMBackup" func init() { - register("OpsWorksCMBackup", ListOpsWorksCMBackups) + resource.Register(resource.Registration{ + Name: OpsWorksCMBackupResource, + Scope: nuke.Account, + Lister: &OpsWorksCMBackupLister{}, + }) } -func ListOpsWorksCMBackups(sess *session.Session) ([]Resource, error) { - svc := opsworkscm.New(sess) - resources := []Resource{} +type OpsWorksCMBackupLister struct{} + +func (l *OpsWorksCMBackupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opsworkscm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &opsworkscm.DescribeBackupsInput{} @@ -35,8 +45,12 @@ func ListOpsWorksCMBackups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *OpsWorksCMBackup) Remove() error { +type OpsWorksCMBackup struct { + svc *opsworkscm.OpsWorksCM + ID *string +} +func (f *OpsWorksCMBackup) Remove(_ context.Context) error { _, err := f.svc.DeleteBackup(&opsworkscm.DeleteBackupInput{ BackupId: f.ID, }) diff --git a/resources/opsworkscm-servers.go b/resources/opsworkscm-servers.go index 3f586b25d..c5091ff71 100644 --- a/resources/opsworkscm-servers.go +++ b/resources/opsworkscm-servers.go @@ -1,23 +1,32 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/opsworkscm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OpsWorksCMServer struct { - svc *opsworkscm.OpsWorksCM - name *string - status *string -} +const OpsWorksCMServerResource = "OpsWorksCMServer" func init() { - register("OpsWorksCMServer", ListOpsWorksCMServers) + resource.Register(resource.Registration{ + Name: OpsWorksCMServerResource, + Scope: nuke.Account, + Lister: &OpsWorksCMServerLister{}, + }) } -func ListOpsWorksCMServers(sess *session.Session) ([]Resource, error) { - svc := opsworkscm.New(sess) - resources := []Resource{} +type OpsWorksCMServerLister struct{} + +func (l *OpsWorksCMServerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opsworkscm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &opsworkscm.DescribeServersInput{} @@ -36,8 +45,13 @@ func ListOpsWorksCMServers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *OpsWorksCMServer) Remove() error { +type OpsWorksCMServer struct { + svc *opsworkscm.OpsWorksCM + name *string + status *string +} +func (f *OpsWorksCMServer) Remove(_ context.Context) error { _, err := f.svc.DeleteServer(&opsworkscm.DeleteServerInput{ ServerName: f.name, }) diff --git a/resources/opsworkscm-serverstates.go b/resources/opsworkscm-serverstates.go index 5b3f14d0c..a8193a6b8 100644 --- a/resources/opsworkscm-serverstates.go +++ b/resources/opsworkscm-serverstates.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/opsworkscm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type OpsWorksCMServerState struct { - svc *opsworkscm.OpsWorksCM - name *string - status *string -} +const OpsWorksCMServerStateResource = "OpsWorksCMServerState" func init() { - register("OpsWorksCMServerState", ListOpsWorksCMServerStates) + resource.Register(resource.Registration{ + Name: OpsWorksCMServerStateResource, + Scope: nuke.Account, + Lister: &OpsWorksCMServerStateLister{}, + }) } -func ListOpsWorksCMServerStates(sess *session.Session) ([]Resource, error) { - svc := opsworkscm.New(sess) - resources := []Resource{} +type OpsWorksCMServerStateLister struct{} + +func (l *OpsWorksCMServerStateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := opsworkscm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &opsworkscm.DescribeServersInput{} @@ -39,7 +48,13 @@ func ListOpsWorksCMServerStates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *OpsWorksCMServerState) Remove() error { +type OpsWorksCMServerState struct { + svc *opsworkscm.OpsWorksCM + name *string + status *string +} + +func (f *OpsWorksCMServerState) Remove(_ context.Context) error { return nil } diff --git a/resources/prometheusservice-workspace.go b/resources/prometheusservice-workspace.go index f648300c4..353f1cbc9 100644 --- a/resources/prometheusservice-workspace.go +++ b/resources/prometheusservice-workspace.go @@ -1,26 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/prometheusservice" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type AMPWorkspace struct { - svc *prometheusservice.PrometheusService - workspaceAlias *string - workspaceARN *string - workspaceId *string -} +const AMPWorkspaceResource = "AMPWorkspace" func init() { - register("AMPWorkspace", ListAMPWorkspaces, - mapCloudControl("AWS::APS::Workspace")) + resource.Register(resource.Registration{ + Name: AMPWorkspaceResource, + Scope: nuke.Account, + Lister: &WorkspaceLister{}, + }) } -func ListAMPWorkspaces(sess *session.Session) ([]Resource, error) { - svc := prometheusservice.New(sess) - resources := []Resource{} +type AMPWorkspaceLister struct{} + +func (l *AMPWorkspaceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := prometheusservice.New(opts.Session) + resources := make([]resource.Resource, 0) var ampWorkspaces []*prometheusservice.WorkspaceSummary err := svc.ListWorkspacesPages( @@ -46,7 +53,14 @@ func ListAMPWorkspaces(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *AMPWorkspace) Remove() error { +type AMPWorkspace struct { + svc *prometheusservice.PrometheusService + workspaceAlias *string + workspaceARN *string + workspaceId *string +} + +func (f *AMPWorkspace) Remove(_ context.Context) error { _, err := f.svc.DeleteWorkspace(&prometheusservice.DeleteWorkspaceInput{ WorkspaceId: f.workspaceId, }) diff --git a/resources/qldb_ledger.go b/resources/qldb-ledger.go similarity index 61% rename from resources/qldb_ledger.go rename to resources/qldb-ledger.go index c00b7b053..73053e6da 100644 --- a/resources/qldb_ledger.go +++ b/resources/qldb-ledger.go @@ -1,31 +1,39 @@ package resources import ( + "context" + "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/qldb" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) -type QLDBLedger struct { - svc *qldb.QLDB - ledger *qldb.DescribeLedgerOutput + "github.com/ekristen/libnuke/pkg/featureflag" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" - featureFlags config.FeatureFlags -} + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +const QLDBLedgerResource = "QLDBLedger" func init() { - register("QLDBLedger", ListQLDBLedgers) + resource.Register(resource.Registration{ + Name: QLDBLedgerResource, + Scope: nuke.Account, + Lister: &QLDBLedgerLister{}, + }) } -func ListQLDBLedgers(sess *session.Session) ([]Resource, error) { - svc := qldb.New(sess) +type QLDBLedgerLister struct{} + +func (l *QLDBLedgerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := qldb.New(opts.Session) params := &qldb.ListLedgersInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListLedgers(params) @@ -54,17 +62,29 @@ func ListQLDBLedgers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (l *QLDBLedger) FeatureFlags(ff config.FeatureFlags) { +type QLDBLedger struct { + svc *qldb.QLDB + ledger *qldb.DescribeLedgerOutput + + featureFlags *featureflag.FeatureFlags +} + +func (l *QLDBLedger) FeatureFlags(ff *featureflag.FeatureFlags) { l.featureFlags = ff } -func (l *QLDBLedger) Remove() error { - if aws.BoolValue(l.ledger.DeletionProtection) && l.featureFlags.DisableDeletionProtection.QLDBLedger { +func (l *QLDBLedger) Remove(_ context.Context) error { + ffDDP, err := l.featureFlags.Get("DisableDeletionProtection_QLDBLedger") + if err != nil { + return err + } + + if aws.BoolValue(l.ledger.DeletionProtection) && ffDDP.Enabled() { modifyParams := &qldb.UpdateLedgerInput{ DeletionProtection: aws.Bool(false), Name: l.ledger.Name, } - _, err := l.svc.UpdateLedger((modifyParams)) + _, err := l.svc.UpdateLedger(modifyParams) if err != nil { return err } @@ -74,8 +94,7 @@ func (l *QLDBLedger) Remove() error { Name: l.ledger.Name, } - _, err := l.svc.DeleteLedger(params) - if err != nil { + if _, err := l.svc.DeleteLedger(params); err != nil { return err } diff --git a/resources/rds-cluster-snapshots.go b/resources/rds-cluster-snapshots.go index c86169874..18cbc38a5 100644 --- a/resources/rds-cluster-snapshots.go +++ b/resources/rds-cluster-snapshots.go @@ -1,26 +1,34 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RDSClusterSnapshot struct { - svc *rds.RDS - snapshot *rds.DBClusterSnapshot - tags []*rds.Tag -} +const RDSClusterSnapshotResource = "RDSClusterSnapshot" func init() { - register("RDSClusterSnapshot", ListRDSClusterSnapshots) + resource.Register(resource.Registration{ + Name: RDSClusterSnapshotResource, + Scope: nuke.Account, + Lister: &RDSClusterSnapshotLister{}, + }) } -func ListRDSClusterSnapshots(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +type RDSClusterSnapshotLister struct{} + +func (l *RDSClusterSnapshotLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeDBClusterSnapshotsInput{MaxRecords: aws.Int64(100)} @@ -28,7 +36,7 @@ func ListRDSClusterSnapshots(sess *session.Session) ([]Resource, error) { if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource for _, snapshot := range resp.DBClusterSnapshots { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ ResourceName: snapshot.DBClusterSnapshotArn, @@ -48,6 +56,12 @@ func ListRDSClusterSnapshots(sess *session.Session) ([]Resource, error) { return resources, nil } +type RDSClusterSnapshot struct { + svc *rds.RDS + snapshot *rds.DBClusterSnapshot + tags []*rds.Tag +} + func (i *RDSClusterSnapshot) Filter() error { if *i.snapshot.SnapshotType == "automated" { return fmt.Errorf("cannot delete automated snapshots") @@ -55,7 +69,7 @@ func (i *RDSClusterSnapshot) Filter() error { return nil } -func (i *RDSClusterSnapshot) Remove() error { +func (i *RDSClusterSnapshot) Remove(_ context.Context) error { if i.snapshot.DBClusterSnapshotIdentifier == nil { // Sanity check to make sure the delete request does not skip the // identifier. diff --git a/resources/rds-clusters.go b/resources/rds-clusters.go index 882712517..4e5345bd9 100644 --- a/resources/rds-clusters.go +++ b/resources/rds-clusters.go @@ -1,25 +1,32 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RDSDBCluster struct { - svc *rds.RDS - id string - deletionProtection bool - tags []*rds.Tag -} +const RDSDBClusterResource = "RDSDBCluster" func init() { - register("RDSDBCluster", ListRDSClusters) + resource.Register(resource.Registration{ + Name: RDSDBClusterResource, + Scope: nuke.Account, + Lister: &RDSDBClusterLister{}, + }) } -func ListRDSClusters(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +type RDSDBClusterLister struct{} + +func (l *RDSDBClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeDBClustersInput{} resp, err := svc.DescribeDBClusters(params) @@ -27,15 +34,15 @@ func ListRDSClusters(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, instance := range resp.DBClusters { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ - ResourceName: instance.DBClusterArn, - }) + ResourceName: instance.DBClusterArn, + }) - if err != nil { - continue - } + if err != nil { + continue + } resources = append(resources, &RDSDBCluster{ svc: svc, @@ -48,8 +55,15 @@ func ListRDSClusters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *RDSDBCluster) Remove() error { - if (i.deletionProtection) { +type RDSDBCluster struct { + svc *rds.RDS + id string + deletionProtection bool + tags []*rds.Tag +} + +func (i *RDSDBCluster) Remove(_ context.Context) error { + if i.deletionProtection { modifyParams := &rds.ModifyDBClusterInput{ DBClusterIdentifier: &i.id, DeletionProtection: aws.Bool(false), @@ -78,13 +92,13 @@ func (i *RDSDBCluster) String() string { } func (i *RDSDBCluster) Properties() types.Properties { - properties := types.NewProperties() - properties.Set("Identifier", i.id) + properties := types.NewProperties() + properties.Set("Identifier", i.id) properties.Set("Deletion Protection", i.deletionProtection) - for _, tag := range i.tags { - properties.SetTag(tag.Key, tag.Value) - } + for _, tag := range i.tags { + properties.SetTag(tag.Key, tag.Value) + } - return properties + return properties } diff --git a/resources/rds-dbclusterparametergroups.go b/resources/rds-dbclusterparametergroups.go index 9466d8c52..8e74cbc21 100644 --- a/resources/rds-dbclusterparametergroups.go +++ b/resources/rds-dbclusterparametergroups.go @@ -1,46 +1,54 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RDSDBClusterParameterGroup struct { - svc *rds.RDS - name *string - tags []*rds.Tag -} +const RDSDBClusterParameterGroupResource = "RDSDBClusterParameterGroup" func init() { - register("RDSDBClusterParameterGroup", ListRDSClusterParameterGroups) + resource.Register(resource.Registration{ + Name: RDSDBClusterParameterGroupResource, + Scope: nuke.Account, + Lister: &RDSDBClusterParameterGroupLister{}, + }) } -func ListRDSClusterParameterGroups(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +type RDSDBClusterParameterGroupLister struct{} + +func (l *RDSDBClusterParameterGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeDBClusterParameterGroupsInput{MaxRecords: aws.Int64(100)} resp, err := svc.DescribeDBClusterParameterGroups(params) if err != nil { return nil, err } - var resources []Resource - for _, parametergroup := range resp.DBClusterParameterGroups { + var resources []resource.Resource + for _, group := range resp.DBClusterParameterGroups { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ - ResourceName: parametergroup.DBClusterParameterGroupArn, - }) + ResourceName: group.DBClusterParameterGroupArn, + }) - if err != nil { - continue - } + if err != nil { + continue + } resources = append(resources, &RDSDBClusterParameterGroup{ svc: svc, - name: parametergroup.DBClusterParameterGroupName, + name: group.DBClusterParameterGroupName, tags: tags.TagList, }) @@ -49,14 +57,20 @@ func ListRDSClusterParameterGroups(sess *session.Session) ([]Resource, error) { return resources, nil } +type RDSDBClusterParameterGroup struct { + svc *rds.RDS + name *string + tags []*rds.Tag +} + func (i *RDSDBClusterParameterGroup) Filter() error { if strings.HasPrefix(*i.name, "default.") { - return fmt.Errorf("Cannot delete default parameter group") + return fmt.Errorf("cannot delete default parameter group") } return nil } -func (i *RDSDBClusterParameterGroup) Remove() error { +func (i *RDSDBClusterParameterGroup) Remove(_ context.Context) error { params := &rds.DeleteDBClusterParameterGroupInput{ DBClusterParameterGroupName: i.name, } diff --git a/resources/rds-dbparametergroups.go b/resources/rds-dbparametergroups.go index f4db4a7e4..e49fd47d8 100644 --- a/resources/rds-dbparametergroups.go +++ b/resources/rds-dbparametergroups.go @@ -1,37 +1,51 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const RDSDBParameterGroupResource = "RDSDBParameterGroup" + +func init() { + resource.Register(resource.Registration{ + Name: RDSDBParameterGroupResource, + Scope: nuke.Account, + Lister: &RDSDBParameterGroupLister{}, + }) +} + +type RDSDBParameterGroupLister struct{} + type RDSDBParameterGroup struct { svc *rds.RDS name *string tags []*rds.Tag } -func init() { - register("RDSDBParameterGroup", ListRDSParameterGroups) -} - -func ListRDSParameterGroups(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +func (l *RDSDBParameterGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeDBParameterGroupsInput{MaxRecords: aws.Int64(100)} resp, err := svc.DescribeDBParameterGroups(params) if err != nil { return nil, err } - var resources []Resource - for _, parametergroup := range resp.DBParameterGroups { + var resources []resource.Resource + for _, group := range resp.DBParameterGroups { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ - ResourceName: parametergroup.DBParameterGroupArn, + ResourceName: group.DBParameterGroupArn, }) if err != nil { @@ -40,7 +54,7 @@ func ListRDSParameterGroups(sess *session.Session) ([]Resource, error) { resources = append(resources, &RDSDBParameterGroup{ svc: svc, - name: parametergroup.DBParameterGroupName, + name: group.DBParameterGroupName, tags: tags.TagList, }) @@ -51,12 +65,12 @@ func ListRDSParameterGroups(sess *session.Session) ([]Resource, error) { func (i *RDSDBParameterGroup) Filter() error { if strings.HasPrefix(*i.name, "default.") { - return fmt.Errorf("Cannot delete default parameter group") + return fmt.Errorf("cannot delete default parameter group") } return nil } -func (i *RDSDBParameterGroup) Remove() error { +func (i *RDSDBParameterGroup) Remove(_ context.Context) error { params := &rds.DeleteDBParameterGroupInput{ DBParameterGroupName: i.name, } diff --git a/resources/rds-event-subscriptions.go b/resources/rds-event-subscriptions.go index d434945af..3127c9e8e 100644 --- a/resources/rds-event-subscriptions.go +++ b/resources/rds-event-subscriptions.go @@ -1,12 +1,29 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const RDSEventSubscriptionResource = "RDSEventSubscription" + +func init() { + resource.Register(resource.Registration{ + Name: RDSEventSubscriptionResource, + Scope: nuke.Account, + Lister: &RDSEventSubscriptionLister{}, + }) +} + +type RDSEventSubscriptionLister struct{} + type RDSEventSubscription struct { svc *rds.RDS id *string @@ -14,12 +31,9 @@ type RDSEventSubscription struct { tags []*rds.Tag } -func init() { - register("RDSEventSubscription", ListRDSEventSubscriptions) -} - -func ListRDSEventSubscriptions(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +func (l *RDSEventSubscriptionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeEventSubscriptionsInput{ MaxRecords: aws.Int64(100), @@ -28,7 +42,7 @@ func ListRDSEventSubscriptions(sess *session.Session) ([]Resource, error) { if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource for _, eventSubscription := range resp.EventSubscriptionsList { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ ResourceName: eventSubscription.EventSubscriptionArn, @@ -50,7 +64,7 @@ func ListRDSEventSubscriptions(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *RDSEventSubscription) Remove() error { +func (i *RDSEventSubscription) Remove(_ context.Context) error { params := &rds.DeleteEventSubscriptionInput{ SubscriptionName: i.id, } diff --git a/resources/rds-instances.go b/resources/rds-instances.go index 0c712efd6..fd0e5e503 100644 --- a/resources/rds-instances.go +++ b/resources/rds-instances.go @@ -1,29 +1,44 @@ package resources import ( + "context" + + "github.com/ekristen/libnuke/pkg/featureflag" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/config" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const RDSInstanceResource = "RDSInstance" + +func init() { + resource.Register(resource.Registration{ + Name: RDSInstanceResource, + Scope: nuke.Account, + Lister: &RDSInstanceLister{}, + }) +} + type RDSInstance struct { svc *rds.RDS instance *rds.DBInstance tags []*rds.Tag - featureFlags config.FeatureFlags + featureFlags *featureflag.FeatureFlags } -func init() { - register("RDSInstance", ListRDSInstances) -} +type RDSInstanceLister struct{} + +func (l *RDSInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) -func ListRDSInstances(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) + svc := rds.New(opts.Session) params := &rds.DescribeDBInstancesInput{} resp, err := svc.DescribeDBInstances(params) @@ -31,7 +46,7 @@ func ListRDSInstances(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, instance := range resp.DBInstances { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ ResourceName: instance.DBInstanceArn, @@ -51,18 +66,22 @@ func ListRDSInstances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *RDSInstance) FeatureFlags(ff config.FeatureFlags) { +func (i *RDSInstance) FeatureFlags(ff *featureflag.FeatureFlags) { i.featureFlags = ff } -func (i *RDSInstance) Remove() error { - if aws.BoolValue(i.instance.DeletionProtection) && i.featureFlags.DisableDeletionProtection.RDSInstance { +func (i *RDSInstance) Remove(_ context.Context) error { + ffddpRDSInstance, err := i.featureFlags.Get("DisableDeletionProtection_RDSInstance") + if err != nil { + return err + } + + if aws.BoolValue(i.instance.DeletionProtection) && ffddpRDSInstance.Enabled() { modifyParams := &rds.ModifyDBInstanceInput{ DBInstanceIdentifier: i.instance.DBInstanceIdentifier, DeletionProtection: aws.Bool(false), } - _, err := i.svc.ModifyDBInstance(modifyParams) - if err != nil { + if _, err := i.svc.ModifyDBInstance(modifyParams); err != nil { return err } } @@ -72,8 +91,7 @@ func (i *RDSInstance) Remove() error { SkipFinalSnapshot: aws.Bool(true), } - _, err := i.svc.DeleteDBInstance(params) - if err != nil { + if _, err := i.svc.DeleteDBInstance(params); err != nil { return err } diff --git a/resources/rds-optiongroups.go b/resources/rds-optiongroups.go index 1f33b6aba..d33f5b310 100644 --- a/resources/rds-optiongroups.go +++ b/resources/rds-optiongroups.go @@ -1,34 +1,42 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RDSOptionGroup struct { - svc *rds.RDS - name *string - tags []*rds.Tag -} +const RDSOptionGroupResource = "RDSOptionGroup" func init() { - register("RDSOptionGroup", ListRDSOptionGroups) + resource.Register(resource.Registration{ + Name: RDSOptionGroupResource, + Scope: nuke.Account, + Lister: &RDSOptionGroupLister{}, + }) } -func ListRDSOptionGroups(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +type RDSOptionGroupLister struct{} + +func (l *RDSOptionGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeOptionGroupsInput{MaxRecords: aws.Int64(100)} resp, err := svc.DescribeOptionGroups(params) if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource for _, optionGroup := range resp.OptionGroupsList { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ ResourceName: optionGroup.OptionGroupArn, @@ -49,6 +57,12 @@ func ListRDSOptionGroups(sess *session.Session) ([]Resource, error) { return resources, nil } +type RDSOptionGroup struct { + svc *rds.RDS + name *string + tags []*rds.Tag +} + func (i *RDSOptionGroup) Filter() error { if strings.HasPrefix(*i.name, "default:") { return fmt.Errorf("cannot delete default Option group") @@ -56,7 +70,7 @@ func (i *RDSOptionGroup) Filter() error { return nil } -func (i *RDSOptionGroup) Remove() error { +func (i *RDSOptionGroup) Remove(_ context.Context) error { params := &rds.DeleteOptionGroupInput{ OptionGroupName: i.name, } diff --git a/resources/rds-proxies.go b/resources/rds-proxies.go index c9631ffc7..a4c925a3b 100644 --- a/resources/rds-proxies.go +++ b/resources/rds-proxies.go @@ -1,23 +1,29 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" ) -type RDSProxy struct { - svc *rds.RDS - id string - tags []*rds.Tag -} +const RDSProxyResource = "RDSProxy" func init() { - register("RDSProxy", ListRDSProxies) + resource.Register(resource.Registration{ + Name: RDSProxyResource, + Scope: nuke.Account, + Lister: &RDSProxyLister{}, + }) } -func ListRDSProxies(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +type RDSProxyLister struct{} + +func (l *RDSProxyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeDBProxiesInput{} resp, err := svc.DescribeDBProxies(params) @@ -25,7 +31,7 @@ func ListRDSProxies(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, instance := range resp.DBProxies { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ ResourceName: instance.DBProxyArn, @@ -45,7 +51,13 @@ func ListRDSProxies(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *RDSProxy) Remove() error { +type RDSProxy struct { + svc *rds.RDS + id string + tags []*rds.Tag +} + +func (i *RDSProxy) Remove(_ context.Context) error { params := &rds.DeleteDBProxyInput{ DBProxyName: &i.id, } diff --git a/resources/rds-snapshots.go b/resources/rds-snapshots.go index 8070e8a93..3bef18cc9 100644 --- a/resources/rds-snapshots.go +++ b/resources/rds-snapshots.go @@ -1,34 +1,42 @@ package resources import ( + "context" + "fmt" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RDSSnapshot struct { - svc *rds.RDS - snapshot *rds.DBSnapshot - tags []*rds.Tag -} +const RDSSnapshotResource = "RDSSnapshot" func init() { - register("RDSSnapshot", ListRDSSnapshots) + resource.Register(resource.Registration{ + Name: RDSSnapshotResource, + Scope: nuke.Account, + Lister: &RDSSnapshotLister{}, + }) } -func ListRDSSnapshots(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +type RDSSnapshotLister struct{} + +func (l *RDSSnapshotLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeDBSnapshotsInput{MaxRecords: aws.Int64(100)} resp, err := svc.DescribeDBSnapshots(params) if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource for _, snapshot := range resp.DBSnapshots { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ ResourceName: snapshot.DBSnapshotArn, @@ -48,6 +56,12 @@ func ListRDSSnapshots(sess *session.Session) ([]Resource, error) { return resources, nil } +type RDSSnapshot struct { + svc *rds.RDS + snapshot *rds.DBSnapshot + tags []*rds.Tag +} + func (i *RDSSnapshot) Filter() error { if *i.snapshot.SnapshotType == "automated" { return fmt.Errorf("cannot delete automated snapshots") @@ -55,7 +69,7 @@ func (i *RDSSnapshot) Filter() error { return nil } -func (i *RDSSnapshot) Remove() error { +func (i *RDSSnapshot) Remove(_ context.Context) error { if i.snapshot.DBSnapshotIdentifier == nil { // Sanity check to make sure the delete request does not skip the // identifier. diff --git a/resources/rds-subnets.go b/resources/rds-subnets.go index 17978a195..e253b82a7 100644 --- a/resources/rds-subnets.go +++ b/resources/rds-subnets.go @@ -1,39 +1,53 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rds" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const RDSDBSubnetGroupResource = "RDSDBSubnetGroup" + +func init() { + resource.Register(resource.Registration{ + Name: RDSDBSubnetGroupResource, + Scope: nuke.Account, + Lister: &RDSDBSubnetGroupLister{}, + }) +} + +type RDSDBSubnetGroupLister struct{} + type RDSDBSubnetGroup struct { svc *rds.RDS name *string tags []*rds.Tag } -func init() { - register("RDSDBSubnetGroup", ListRDSSubnetGroups) -} - -func ListRDSSubnetGroups(sess *session.Session) ([]Resource, error) { - svc := rds.New(sess) +func (l *RDSDBSubnetGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := rds.New(opts.Session) params := &rds.DescribeDBSubnetGroupsInput{MaxRecords: aws.Int64(100)} resp, err := svc.DescribeDBSubnetGroups(params) if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource for _, subnetGroup := range resp.DBSubnetGroups { tags, err := svc.ListTagsForResource(&rds.ListTagsForResourceInput{ - ResourceName: subnetGroup.DBSubnetGroupArn, - }) + ResourceName: subnetGroup.DBSubnetGroupArn, + }) - if err != nil { - continue - } + if err != nil { + continue + } resources = append(resources, &RDSDBSubnetGroup{ svc: svc, @@ -46,7 +60,7 @@ func ListRDSSubnetGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (i *RDSDBSubnetGroup) Remove() error { +func (i *RDSDBSubnetGroup) Remove(_ context.Context) error { params := &rds.DeleteDBSubnetGroupInput{ DBSubnetGroupName: i.name, } @@ -64,12 +78,12 @@ func (i *RDSDBSubnetGroup) String() string { } func (i *RDSDBSubnetGroup) Properties() types.Properties { - properties := types.NewProperties() - properties.Set("Name", i.name) + properties := types.NewProperties() + properties.Set("Name", i.name) - for _, tag := range i.tags { - properties.SetTag(tag.Key, tag.Value) - } + for _, tag := range i.tags { + properties.SetTag(tag.Key, tag.Value) + } - return properties + return properties } diff --git a/resources/redshift-clusters.go b/resources/redshift-clusters.go index b6fc92bc2..abe80f56c 100644 --- a/resources/redshift-clusters.go +++ b/resources/redshift-clusters.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/redshift" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RedshiftCluster struct { - svc *redshift.Redshift - cluster *redshift.Cluster -} +const RedshiftClusterResource = "RedshiftCluster" func init() { - register("RedshiftCluster", ListRedshiftClusters) + resource.Register(resource.Registration{ + Name: RedshiftClusterResource, + Scope: nuke.Account, + Lister: &RedshiftClusterLister{}, + }) } -func ListRedshiftClusters(sess *session.Session) ([]Resource, error) { - svc := redshift.New(sess) - resources := []Resource{} +type RedshiftClusterLister struct{} + +func (l *RedshiftClusterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := redshift.New(opts.Session) + resources := make([]resource.Resource, 0) params := &redshift.DescribeClustersInput{ MaxRecords: aws.Int64(100), @@ -47,6 +57,11 @@ func ListRedshiftClusters(sess *session.Session) ([]Resource, error) { return resources, nil } +type RedshiftCluster struct { + svc *redshift.Redshift + cluster *redshift.Cluster +} + func (f *RedshiftCluster) Properties() types.Properties { properties := types.NewProperties(). Set("CreatedTime", f.cluster.ClusterCreateTime) @@ -58,7 +73,7 @@ func (f *RedshiftCluster) Properties() types.Properties { return properties } -func (f *RedshiftCluster) Remove() error { +func (f *RedshiftCluster) Remove(_ context.Context) error { _, err := f.svc.DeleteCluster(&redshift.DeleteClusterInput{ ClusterIdentifier: f.cluster.ClusterIdentifier, diff --git a/resources/redshift-parametergroups.go b/resources/redshift-parametergroups.go index 5adda7936..9f2c492d0 100644 --- a/resources/redshift-parametergroups.go +++ b/resources/redshift-parametergroups.go @@ -1,25 +1,35 @@ package resources import ( + "context" + "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/redshift" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RedshiftParameterGroup struct { - svc *redshift.Redshift - parameterGroupName *string -} +const RedshiftParameterGroupResource = "RedshiftParameterGroup" func init() { - register("RedshiftParameterGroup", ListRedshiftParameterGroup) + resource.Register(resource.Registration{ + Name: RedshiftParameterGroupResource, + Scope: nuke.Account, + Lister: &RedshiftParameterGroupLister{}, + }) } -func ListRedshiftParameterGroup(sess *session.Session) ([]Resource, error) { - svc := redshift.New(sess) - resources := []Resource{} +type RedshiftParameterGroupLister struct{} + +func (l *RedshiftParameterGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := redshift.New(opts.Session) + resources := make([]resource.Resource, 0) params := &redshift.DescribeClusterParameterGroupsInput{ MaxRecords: aws.Int64(100), @@ -50,8 +60,12 @@ func ListRedshiftParameterGroup(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *RedshiftParameterGroup) Remove() error { +type RedshiftParameterGroup struct { + svc *redshift.Redshift + parameterGroupName *string +} +func (f *RedshiftParameterGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteClusterParameterGroup(&redshift.DeleteClusterParameterGroupInput{ ParameterGroupName: f.parameterGroupName, }) diff --git a/resources/redshift-snapshots.go b/resources/redshift-snapshots.go index 8768e33b4..42fcc40b7 100644 --- a/resources/redshift-snapshots.go +++ b/resources/redshift-snapshots.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/redshift" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RedshiftSnapshot struct { - svc *redshift.Redshift - snapshot *redshift.Snapshot -} +const RedshiftSnapshotResource = "RedshiftSnapshot" func init() { - register("RedshiftSnapshot", ListRedshiftSnapshots) + resource.Register(resource.Registration{ + Name: RedshiftSnapshotResource, + Scope: nuke.Account, + Lister: &RedshiftSnapshotLister{}, + }) } -func ListRedshiftSnapshots(sess *session.Session) ([]Resource, error) { - svc := redshift.New(sess) - resources := []Resource{} +type RedshiftSnapshotLister struct{} + +func (l *RedshiftSnapshotLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := redshift.New(opts.Session) + resources := make([]resource.Resource, 0) params := &redshift.DescribeClusterSnapshotsInput{ MaxRecords: aws.Int64(100), @@ -47,6 +57,11 @@ func ListRedshiftSnapshots(sess *session.Session) ([]Resource, error) { return resources, nil } +type RedshiftSnapshot struct { + svc *redshift.Redshift + snapshot *redshift.Snapshot +} + func (f *RedshiftSnapshot) Properties() types.Properties { properties := types.NewProperties(). Set("CreatedTime", f.snapshot.SnapshotCreateTime) @@ -58,8 +73,7 @@ func (f *RedshiftSnapshot) Properties() types.Properties { return properties } -func (f *RedshiftSnapshot) Remove() error { - +func (f *RedshiftSnapshot) Remove(_ context.Context) error { _, err := f.svc.DeleteClusterSnapshot(&redshift.DeleteClusterSnapshotInput{ SnapshotIdentifier: f.snapshot.SnapshotIdentifier, }) diff --git a/resources/redshift-subnetgroups.go b/resources/redshift-subnetgroups.go index a94600c13..3cfbafe3c 100644 --- a/resources/redshift-subnetgroups.go +++ b/resources/redshift-subnetgroups.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/redshift" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RedshiftSubnetGroup struct { - svc *redshift.Redshift - clusterSubnetGroupName *string -} +const RedshiftSubnetGroupResource = "RedshiftSubnetGroup" func init() { - register("RedshiftSubnetGroup", ListRedshiftSubnetGroups) + resource.Register(resource.Registration{ + Name: RedshiftSubnetGroupResource, + Scope: nuke.Account, + Lister: &RedshiftSubnetGroupLister{}, + }) } -func ListRedshiftSubnetGroups(sess *session.Session) ([]Resource, error) { - svc := redshift.New(sess) - resources := []Resource{} +type RedshiftSubnetGroupLister struct{} + +func (l *RedshiftSubnetGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := redshift.New(opts.Session) + resources := make([]resource.Resource, 0) params := &redshift.DescribeClusterSubnetGroupsInput{ MaxRecords: aws.Int64(100), @@ -31,7 +41,7 @@ func ListRedshiftSubnetGroups(sess *session.Session) ([]Resource, error) { for _, subnetGroup := range output.ClusterSubnetGroups { resources = append(resources, &RedshiftSubnetGroup{ - svc: svc, + svc: svc, clusterSubnetGroupName: subnetGroup.ClusterSubnetGroupName, }) } @@ -46,8 +56,12 @@ func ListRedshiftSubnetGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *RedshiftSubnetGroup) Remove() error { +type RedshiftSubnetGroup struct { + svc *redshift.Redshift + clusterSubnetGroupName *string +} +func (f *RedshiftSubnetGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteClusterSubnetGroup(&redshift.DeleteClusterSubnetGroupInput{ ClusterSubnetGroupName: f.clusterSubnetGroupName, }) diff --git a/resources/rekognition-collection.go b/resources/rekognition-collection.go index cf2347eed..20ff430b1 100644 --- a/resources/rekognition-collection.go +++ b/resources/rekognition-collection.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/rekognition" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RekognitionCollection struct { - svc *rekognition.Rekognition - id *string -} +const RekognitionCollectionResource = "RekognitionCollection" func init() { - register("RekognitionCollection", ListRekognitionCollections) + resource.Register(resource.Registration{ + Name: RekognitionCollectionResource, + Scope: nuke.Account, + Lister: &RekognitionCollectionLister{}, + }) } -func ListRekognitionCollections(sess *session.Session) ([]Resource, error) { - svc := rekognition.New(sess) - resources := []Resource{} +type RekognitionCollectionLister struct{} + +func (l *RekognitionCollectionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := rekognition.New(opts.Session) + resources := make([]resource.Resource, 0) params := &rekognition.ListCollectionsInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListRekognitionCollections(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *RekognitionCollection) Remove() error { +type RekognitionCollection struct { + svc *rekognition.Rekognition + id *string +} +func (f *RekognitionCollection) Remove(_ context.Context) error { _, err := f.svc.DeleteCollection(&rekognition.DeleteCollectionInput{ CollectionId: f.id, }) diff --git a/resources/resource-explorer2-indexes.go b/resources/resource-explorer2-indexes.go index 4a84a3377..151e8d355 100644 --- a/resources/resource-explorer2-indexes.go +++ b/resources/resource-explorer2-indexes.go @@ -1,23 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/resourceexplorer2" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) +const ResourceExplorer2IndexResource = "ResourceExplorer2Index" + +func init() { + resource.Register(resource.Registration{ + Name: ResourceExplorer2IndexResource, + Scope: nuke.Account, + Lister: &ResourceExplorer2IndexLister{}, + }) +} + +type ResourceExplorer2IndexLister struct{} + type ResourceExplorer2Index struct { svc *resourceexplorer2.ResourceExplorer2 indexArn *string } -func init() { - register("ResourceExplorer2Index", ResourceExplorer2Indexes) -} - -func ResourceExplorer2Indexes(sess *session.Session) ([]Resource, error) { - svc := resourceexplorer2.New(sess) - var resources []Resource +func (l *ResourceExplorer2IndexLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := resourceexplorer2.New(opts.Session) + var resources []resource.Resource params := &resourceexplorer2.ListIndexesInput{} @@ -44,7 +56,7 @@ func ResourceExplorer2Indexes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ResourceExplorer2Index) Remove() error { +func (f *ResourceExplorer2Index) Remove(_ context.Context) error { _, err := f.svc.DeleteIndex(&resourceexplorer2.DeleteIndexInput{ Arn: f.indexArn, }) diff --git a/resources/resource-explorer2-views.go b/resources/resource-explorer2-views.go index 25a0c9b21..12e64661c 100644 --- a/resources/resource-explorer2-views.go +++ b/resources/resource-explorer2-views.go @@ -1,23 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/resourceexplorer2" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) +const ResourceExplorer2ViewResource = "ResourceExplorer2View" + +func init() { + resource.Register(resource.Registration{ + Name: ResourceExplorer2ViewResource, + Scope: nuke.Account, + Lister: &ResourceExplorer2ViewLister{}, + }) +} + +type ResourceExplorer2ViewLister struct{} + type ResourceExplorer2View struct { svc *resourceexplorer2.ResourceExplorer2 viewArn *string } -func init() { - register("ResourceExplorer2View", ResourceExplorer2Views) -} - -func ResourceExplorer2Views(sess *session.Session) ([]Resource, error) { - svc := resourceexplorer2.New(sess) - var resources []Resource +func (l *ResourceExplorer2ViewLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := resourceexplorer2.New(opts.Session) + var resources []resource.Resource params := &resourceexplorer2.ListViewsInput{} @@ -44,7 +56,7 @@ func ResourceExplorer2Views(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ResourceExplorer2View) Remove() error { +func (f *ResourceExplorer2View) Remove(_ context.Context) error { _, err := f.svc.DeleteView(&resourceexplorer2.DeleteViewInput{ ViewArn: f.viewArn, }) diff --git a/resources/resourcegroups-groups.go b/resources/resourcegroups-groups.go index e815130eb..d042f1df5 100644 --- a/resources/resourcegroups-groups.go +++ b/resources/resourcegroups-groups.go @@ -1,23 +1,30 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/resourcegroups" + "github.com/ekristen/aws-nuke/pkg/nuke" + "github.com/ekristen/libnuke/pkg/resource" ) -type ResourceGroupGroup struct { - svc *resourcegroups.ResourceGroups - groupName *string -} +const ResourceGroupGroupResource = "ResourceGroupGroup" func init() { - register("ResourceGroupGroup", ListResourceGroupGroups) + resource.Register(resource.Registration{ + Name: ResourceGroupGroupResource, + Scope: nuke.Account, + Lister: &ResourceGroupGroupLister{}, + }) } -func ListResourceGroupGroups(sess *session.Session) ([]Resource, error) { - svc := resourcegroups.New(sess) - resources := []Resource{} +type ResourceGroupGroupLister struct{} + +func (l *ResourceGroupGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := resourcegroups.New(opts.Session) + var resources []resource.Resource params := &resourcegroups.ListGroupsInput{ MaxResults: aws.Int64(50), @@ -46,10 +53,15 @@ func ListResourceGroupGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ResourceGroupGroup) Remove() error { +type ResourceGroupGroup struct { + svc *resourcegroups.ResourceGroups + groupName *string +} + +func (f *ResourceGroupGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteGroup(&resourcegroups.DeleteGroupInput{ - GroupName: f.groupName, + Group: f.groupName, }) return err diff --git a/resources/robomaker-robot-applications.go b/resources/robomaker-robot-applications.go index 42bb7519b..1f0bde404 100644 --- a/resources/robomaker-robot-applications.go +++ b/resources/robomaker-robot-applications.go @@ -1,25 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/robomaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RoboMakerRobotApplication struct { - svc *robomaker.RoboMaker - name *string - arn *string - version *string -} +const RoboMakerRobotApplicationResource = "RoboMakerRobotApplication" func init() { - register("RoboMakerRobotApplication", ListRoboMakerRobotApplications) + resource.Register(resource.Registration{ + Name: RoboMakerRobotApplicationResource, + Scope: nuke.Account, + Lister: &RoboMakerRobotApplicationLister{}, + }) } -func ListRoboMakerRobotApplications(sess *session.Session) ([]Resource, error) { - svc := robomaker.New(sess) - resources := []Resource{} +type RoboMakerRobotApplicationLister struct{} + +func (l *RoboMakerRobotApplicationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := robomaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &robomaker.ListRobotApplicationsInput{ MaxResults: aws.Int64(30), @@ -50,8 +58,14 @@ func ListRoboMakerRobotApplications(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *RoboMakerRobotApplication) Remove() error { +type RoboMakerRobotApplication struct { + svc *robomaker.RoboMaker + name *string + arn *string + version *string +} +func (f *RoboMakerRobotApplication) Remove(_ context.Context) error { request := robomaker.DeleteRobotApplicationInput{ Application: f.arn, } diff --git a/resources/robomaker-simulation-applications.go b/resources/robomaker-simulation-applications.go index d7d79a0b5..7ed38fea7 100644 --- a/resources/robomaker-simulation-applications.go +++ b/resources/robomaker-simulation-applications.go @@ -1,25 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/robomaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RoboMakerSimulationApplication struct { - svc *robomaker.RoboMaker - name *string - arn *string - version *string -} +const RoboMakerSimulationApplicationResource = "RoboMakerSimulationApplication" func init() { - register("RoboMakerSimulationApplication", ListRoboMakerSimulationApplications) + resource.Register(resource.Registration{ + Name: RoboMakerSimulationApplicationResource, + Scope: nuke.Account, + Lister: &RoboMakerSimulationApplicationLister{}, + }) } -func ListRoboMakerSimulationApplications(sess *session.Session) ([]Resource, error) { - svc := robomaker.New(sess) - resources := []Resource{} +type RoboMakerSimulationApplicationLister struct{} + +func (l *RoboMakerSimulationApplicationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := robomaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &robomaker.ListSimulationApplicationsInput{ MaxResults: aws.Int64(30), @@ -50,7 +58,14 @@ func ListRoboMakerSimulationApplications(sess *session.Session) ([]Resource, err return resources, nil } -func (f *RoboMakerSimulationApplication) Remove() error { +type RoboMakerSimulationApplication struct { + svc *robomaker.RoboMaker + name *string + arn *string + version *string +} + +func (f *RoboMakerSimulationApplication) Remove(_ context.Context) error { request := robomaker.DeleteSimulationApplicationInput{ Application: f.arn, diff --git a/resources/robomaker-simulation-jobs.go b/resources/robomaker-simulation-jobs.go index 88cb8da61..bb988d688 100644 --- a/resources/robomaker-simulation-jobs.go +++ b/resources/robomaker-simulation-jobs.go @@ -1,32 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/robomaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type RoboMakerSimulationJob struct { - svc *robomaker.RoboMaker - name *string - arn *string -} +const RoboMakerSimulationJobResource = "RoboMakerSimulationJob" func init() { - register("RoboMakerSimulationJob", ListRoboMakerSimulationJobs) + resource.Register(resource.Registration{ + Name: RoboMakerSimulationJobResource, + Scope: nuke.Account, + Lister: &RoboMakerSimulationJobLister{}, + }) } -func simulationJobNeedsToBeCanceled(job *robomaker.SimulationJobSummary) bool { - for _, n := range []string{"Completed", "Failed", "RunningFailed", "Terminating", "Terminated", "Canceled"} { - if job.Status != nil && *job.Status == n { - return false - } - } - return true -} -func ListRoboMakerSimulationJobs(sess *session.Session) ([]Resource, error) { - svc := robomaker.New(sess) - resources := []Resource{} +type RoboMakerSimulationJobLister struct{} + +func (l *RoboMakerSimulationJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := robomaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &robomaker.ListSimulationJobsInput{ MaxResults: aws.Int64(30), @@ -57,8 +58,23 @@ func ListRoboMakerSimulationJobs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *RoboMakerSimulationJob) Remove() error { +// simulationJobNeedsToBeCanceled returns true if the simulation job needs to be canceled (helper function) +func simulationJobNeedsToBeCanceled(job *robomaker.SimulationJobSummary) bool { + for _, n := range []string{"Completed", "Failed", "RunningFailed", "Terminating", "Terminated", "Canceled"} { + if job.Status != nil && *job.Status == n { + return false + } + } + return true +} + +type RoboMakerSimulationJob struct { + svc *robomaker.RoboMaker + name *string + arn *string +} +func (f *RoboMakerSimulationJob) Remove(_ context.Context) error { _, err := f.svc.CancelSimulationJob(&robomaker.CancelSimulationJobInput{ Job: f.arn, }) diff --git a/resources/route53-health-checks.go b/resources/route53-health-checks.go index bf4d2cb10..c726c852d 100644 --- a/resources/route53-health-checks.go +++ b/resources/route53-health-checks.go @@ -1,22 +1,37 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/route53" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const Route53HealthCheckResource = "Route53HealthCheck" + func init() { - register("Route53HealthCheck", ListRoute53HealthChecks) + resource.Register(resource.Registration{ + Name: Route53HealthCheckResource, + Scope: nuke.Account, + Lister: &Route53HealthCheckLister{}, + }) } -func ListRoute53HealthChecks(sess *session.Session) ([]Resource, error) { - svc := route53.New(sess) +type Route53HealthCheckLister struct{} + +func (l *Route53HealthCheckLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := route53.New(opts.Session) params := &route53.ListHealthChecksInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListHealthChecks(params) @@ -44,7 +59,7 @@ type Route53HealthCheck struct { id *string } -func (hz *Route53HealthCheck) Remove() error { +func (hz *Route53HealthCheck) Remove(_ context.Context) error { params := &route53.DeleteHealthCheckInput{ HealthCheckId: hz.id, } diff --git a/resources/route53-hosted-zones.go b/resources/route53-hosted-zones.go index 00f86e306..f5098fba7 100644 --- a/resources/route53-hosted-zones.go +++ b/resources/route53-hosted-zones.go @@ -1,20 +1,35 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/route53" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const Route53HostedZoneResource = "Route53HostedZone" + func init() { - register("Route53HostedZone", ListRoute53HostedZones) + resource.Register(resource.Registration{ + Name: Route53HostedZoneResource, + Scope: nuke.Account, + Lister: &Route53HostedZoneLister{}, + }) } -func ListRoute53HostedZones(sess *session.Session) ([]Resource, error) { - svc := route53.New(sess) +type Route53HostedZoneLister struct{} + +func (l *Route53HostedZoneLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := route53.New(opts.Session) var hostedZones []*route53.HostedZone params := &route53.ListHostedZonesInput{} @@ -33,7 +48,7 @@ func ListRoute53HostedZones(sess *session.Session) ([]Resource, error) { } } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, hz := range hostedZones { tags, err := svc.ListTagsForResource(&route53.ListTagsForResourceInput{ ResourceId: hz.Id, @@ -61,7 +76,7 @@ type Route53HostedZone struct { tags []*route53.Tag } -func (hz *Route53HostedZone) Remove() error { +func (hz *Route53HostedZone) Remove(_ context.Context) error { params := &route53.DeleteHostedZoneInput{ Id: hz.id, } diff --git a/resources/route53-resolver-endpoints.go b/resources/route53-resolver-endpoints.go index 608077eee..eae4d2e85 100644 --- a/resources/route53-resolver-endpoints.go +++ b/resources/route53-resolver-endpoints.go @@ -1,31 +1,39 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/route53resolver" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -// Route53ResolverEndpoint is the resource type for nuking -type Route53ResolverEndpoint struct { - svc *route53resolver.Route53Resolver - id *string - name *string -} +const Route53ResolverEndpointResource = "Route53ResolverEndpoint" func init() { - register("Route53ResolverEndpoint", ListRoute53ResolverEndpoints) + resource.Register(resource.Registration{ + Name: Route53ResolverEndpointResource, + Scope: nuke.Account, + Lister: &Route53ResolverEndpointLister{}, + }) } -// ListRoute53ResolverEndpoints produces the resources to be nuked -func ListRoute53ResolverEndpoints(sess *session.Session) ([]Resource, error) { - svc := route53resolver.New(sess) +type Route53ResolverEndpointLister struct{} + +// List produces the raw list of Route53 Resolver Endpoints to be nuked before filtering +func (l *Route53ResolverEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := route53resolver.New(opts.Session) params := &route53resolver.ListResolverEndpointsInput{} - var resources []Resource + var resources []resource.Resource for { resp, err := svc.ListResolverEndpoints(params) @@ -54,8 +62,15 @@ func ListRoute53ResolverEndpoints(sess *session.Session) ([]Resource, error) { return resources, nil } +// Route53ResolverEndpoint is the resource type for nuking +type Route53ResolverEndpoint struct { + svc *route53resolver.Route53Resolver + id *string + name *string +} + // Remove implements Resource -func (r *Route53ResolverEndpoint) Remove() error { +func (r *Route53ResolverEndpoint) Remove(_ context.Context) error { _, err := r.svc.DeleteResolverEndpoint( &route53resolver.DeleteResolverEndpointInput{ ResolverEndpointId: r.id, diff --git a/resources/route53-resolver-rules.go b/resources/route53-resolver-rules.go index 5c3114d1e..757f597c3 100644 --- a/resources/route53-resolver-rules.go +++ b/resources/route53-resolver-rules.go @@ -1,40 +1,44 @@ package resources import ( + "context" + "fmt" - "github.com/aws/smithy-go/ptr" + "github.com/gotidy/ptr" "strings" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/route53resolver" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" -) -type ( - // Route53ResolverRule is the resource type - Route53ResolverRule struct { - svc *route53resolver.Route53Resolver - id *string - name *string - domainName *string - vpcIds []*string - } + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const Route53ResolverRuleResource = "Route53ResolverRule" + func init() { - register("Route53ResolverRule", ListRoute53ResolverRules) + resource.Register(resource.Registration{ + Name: Route53ResolverRuleResource, + Scope: nuke.Account, + Lister: &Route53ResolverRuleLister{}, + }) } -// ListRoute53ResolverRules produces the resources to be nuked. -func ListRoute53ResolverRules(sess *session.Session) ([]Resource, error) { - svc := route53resolver.New(sess) +type Route53ResolverRuleLister struct{} + +// List returns a list of all Route53 ResolverRules before filtering to be nuked +func (l *Route53ResolverRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := route53resolver.New(opts.Session) vpcAssociations, err := resolverRulesToVpcIDs(svc) if err != nil { return nil, err } - var resources []Resource + var resources []resource.Resource params := &route53resolver.ListResolverRulesInput{} for { @@ -64,7 +68,7 @@ func ListRoute53ResolverRules(sess *session.Session) ([]Resource, error) { return resources, nil } -// Associate all the vpcIDs to their resolver rule ID to be disassociated before deleting the rule. +// resolverRulesToVpcIDs - Associate all the vpcIDs to their resolver rule ID to be disassociated before deleting the rule. func resolverRulesToVpcIDs(svc *route53resolver.Route53Resolver) (map[string][]*string, error) { vpcAssociations := map[string][]*string{} @@ -100,10 +104,19 @@ func resolverRulesToVpcIDs(svc *route53resolver.Route53Resolver) (map[string][]* return vpcAssociations, nil } +// Route53ResolverRule is the resource type +type Route53ResolverRule struct { + svc *route53resolver.Route53Resolver + id *string + name *string + domainName *string + vpcIds []*string +} + // Filter removes resources automatically from being nuked func (r *Route53ResolverRule) Filter() error { if r.domainName != nil && ptr.ToString(r.domainName) == "." { - return fmt.Errorf(`Filtering DomainName "."`) + return fmt.Errorf(`filtering DomainName "."`) } if r.id != nil && strings.HasPrefix(ptr.ToString(r.id), "rslvr-autodefined-rr") { @@ -114,7 +127,7 @@ func (r *Route53ResolverRule) Filter() error { } // Remove implements Resource -func (r *Route53ResolverRule) Remove() error { +func (r *Route53ResolverRule) Remove(_ context.Context) error { for _, vpcID := range r.vpcIds { _, err := r.svc.DisassociateResolverRule(&route53resolver.DisassociateResolverRuleInput{ ResolverRuleId: r.id, diff --git a/resources/route53-resource-records.go b/resources/route53-resource-records.go index 35f3bc792..c4d917ec5 100644 --- a/resources/route53-resource-records.go +++ b/resources/route53-resource-records.go @@ -1,38 +1,46 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/route53" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type Route53ResourceRecordSet struct { - svc *route53.Route53 - hostedZoneId *string - hostedZoneName *string - data *route53.ResourceRecordSet - changeId *string -} +const Route53ResourceRecordSetResource = "Route53ResourceRecordSet" func init() { - register("Route53ResourceRecordSet", ListRoute53ResourceRecordSets) + resource.Register(resource.Registration{ + Name: Route53ResourceRecordSetResource, + Scope: nuke.Account, + Lister: &Route53ResourceRecordSetLister{}, + }) } -func ListRoute53ResourceRecordSets(sess *session.Session) ([]Resource, error) { - svc := route53.New(sess) +type Route53ResourceRecordSetLister struct{} - resources := make([]Resource, 0) +func (l *Route53ResourceRecordSetLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) - sub, err := ListRoute53HostedZones(sess) + svc := route53.New(opts.Session) + + resources := make([]resource.Resource, 0) + + zoneLister := &Route53HostedZoneLister{} + sub, err := zoneLister.List(ctx, o) if err != nil { return nil, err } - for _, resource := range sub { - zone := resource.(*Route53HostedZone) + for _, r := range sub { + zone := r.(*Route53HostedZone) rrs, err := ListResourceRecordsForZone(svc, zone.id, zone.name) if err != nil { return nil, err @@ -44,12 +52,12 @@ func ListRoute53ResourceRecordSets(sess *session.Session) ([]Resource, error) { return resources, nil } -func ListResourceRecordsForZone(svc *route53.Route53, zoneId *string, zoneName *string) ([]Resource, error) { +func ListResourceRecordsForZone(svc *route53.Route53, zoneId *string, zoneName *string) ([]resource.Resource, error) { params := &route53.ListResourceRecordSetsInput{ HostedZoneId: zoneId, } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListResourceRecordSets(params) @@ -78,6 +86,14 @@ func ListResourceRecordsForZone(svc *route53.Route53, zoneId *string, zoneName * return resources, nil } +type Route53ResourceRecordSet struct { + svc *route53.Route53 + hostedZoneId *string + hostedZoneName *string + data *route53.ResourceRecordSet + changeId *string +} + func (r *Route53ResourceRecordSet) Filter() error { if *r.data.Type == "NS" && *r.hostedZoneName == *r.data.Name { return fmt.Errorf("cannot delete NS record") @@ -90,7 +106,7 @@ func (r *Route53ResourceRecordSet) Filter() error { return nil } -func (r *Route53ResourceRecordSet) Remove() error { +func (r *Route53ResourceRecordSet) Remove(_ context.Context) error { params := &route53.ChangeResourceRecordSetsInput{ HostedZoneId: r.hostedZoneId, ChangeBatch: &route53.ChangeBatch{ diff --git a/resources/route53-traffic-policies.go b/resources/route53-traffic-policies.go index 01df7167a..bf1b8c1d7 100644 --- a/resources/route53-traffic-policies.go +++ b/resources/route53-traffic-policies.go @@ -1,30 +1,37 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/route53" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type Route53TrafficPolicy struct { - svc *route53.Route53 - id *string - name *string - version *int64 - instances []*route53.TrafficPolicyInstance -} +const Route53TrafficPolicyResource = "Route53TrafficPolicy" func init() { - register("Route53TrafficPolicy", ListRoute53TrafficPolicies) + resource.Register(resource.Registration{ + Name: Route53TrafficPolicyResource, + Scope: nuke.Account, + Lister: &Route53TrafficPolicyLister{}, + }) } -func ListRoute53TrafficPolicies(sess *session.Session) ([]Resource, error) { - svc := route53.New(sess) +type Route53TrafficPolicyLister struct{} + +func (l *Route53TrafficPolicyLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := route53.New(opts.Session) params := &route53.ListTrafficPoliciesInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListTrafficPolicies(params) @@ -85,7 +92,15 @@ func instancesForPolicy(svc *route53.Route53, policyID *string, version *int64) return instances, nil } -func (tp *Route53TrafficPolicy) Remove() error { +type Route53TrafficPolicy struct { + svc *route53.Route53 + id *string + name *string + version *int64 + instances []*route53.TrafficPolicyInstance +} + +func (tp *Route53TrafficPolicy) Remove(_ context.Context) error { for _, instance := range tp.instances { _, err := tp.svc.DeleteTrafficPolicyInstance(&route53.DeleteTrafficPolicyInstanceInput{ Id: instance.Id, diff --git a/resources/s3-access-points.go b/resources/s3-access-points.go index 301ec51b9..e88e7b9c0 100644 --- a/resources/s3-access-points.go +++ b/resources/s3-access-points.go @@ -1,34 +1,43 @@ package resources import ( + "context" + + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3control" "github.com/aws/aws-sdk-go/service/sts" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const S3AccessPointResource = "S3AccessPoint" + func init() { - register("S3AccessPoint", ListS3AccessPoints) + resource.Register(resource.Registration{ + Name: S3AccessPointResource, + Scope: nuke.Account, + Lister: &S3AccessPointLister{}, + }) } -type S3AccessPoint struct { - svc *s3control.S3Control - accountId *string - accessPoint *s3control.AccessPoint -} +type S3AccessPointLister struct{} -func ListS3AccessPoints(s *session.Session) ([]Resource, error) { - // Lookup current account ID - stsSvc := sts.New(s) +func (l *S3AccessPointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + stsSvc := sts.New(opts.Session) callerID, err := stsSvc.GetCallerIdentity(&sts.GetCallerIdentityInput{}) if err != nil { return nil, err } accountId := callerID.Account - resources := []Resource{} - svc := s3control.New(s) + var resources []resource.Resource + svc := s3control.New(opts.Session) for { params := &s3control.ListAccessPointsInput{ AccountId: accountId, @@ -56,7 +65,13 @@ func ListS3AccessPoints(s *session.Session) ([]Resource, error) { return resources, nil } -func (e *S3AccessPoint) Remove() error { +type S3AccessPoint struct { + svc *s3control.S3Control + accountId *string + accessPoint *s3control.AccessPoint +} + +func (e *S3AccessPoint) Remove(_ context.Context) error { _, err := e.svc.DeleteAccessPoint(&s3control.DeleteAccessPointInput{ AccountId: e.accountId, Name: aws.String(*e.accessPoint.Name), @@ -76,5 +91,5 @@ func (e *S3AccessPoint) Properties() types.Properties { } func (e *S3AccessPoint) String() string { - return *e.accessPoint.AccessPointArn + return ptr.ToString(e.accessPoint.AccessPointArn) } diff --git a/resources/s3-buckets.go b/resources/s3-buckets.go index 55181ade7..69eb179a7 100644 --- a/resources/s3-buckets.go +++ b/resources/s3-buckets.go @@ -1,41 +1,52 @@ package resources import ( + "context" + "fmt" "time" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3/s3iface" "github.com/aws/aws-sdk-go/service/s3/s3manager" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const S3BucketResource = "S3Bucket" + func init() { - register("S3Bucket", ListS3Buckets, - mapCloudControl("AWS::S3::Bucket")) + resource.Register(resource.Registration{ + Name: S3BucketResource, + Scope: nuke.Account, + Lister: &S3BucketLister{}, + DependsOn: []string{ + S3ObjectResource, + }, + }, nuke.MapCloudControl("AWS::S3::Bucket")) } -type S3Bucket struct { - svc *s3.S3 - name string - creationDate time.Time - tags []*s3.Tag -} +type S3BucketLister struct{} -func ListS3Buckets(s *session.Session) ([]Resource, error) { - svc := s3.New(s) +func (l *S3BucketLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := s3.New(opts.Session) buckets, err := DescribeS3Buckets(svc) if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, bucket := range buckets { tags, err := svc.GetBucketTagging(&s3.GetBucketTaggingInput{ Bucket: bucket.Name, @@ -80,8 +91,16 @@ func DescribeS3Buckets(svc *s3.S3) ([]s3.Bucket, error) { continue } - location := UnPtrString(bucketLocationResponse.LocationConstraint, endpoints.UsEast1RegionID) - region := UnPtrString(svc.Config.Region, endpoints.UsEast1RegionID) + location := ptr.ToString(bucketLocationResponse.LocationConstraint) + if location == "" { + location = endpoints.UsEast1RegionID + } + + region := ptr.ToString(svc.Config.Region) + if region == "" { + region = endpoints.UsEast1RegionID + } + if location == region && out != nil { buckets = append(buckets, *out) } @@ -90,7 +109,14 @@ func DescribeS3Buckets(svc *s3.S3) ([]s3.Bucket, error) { return buckets, nil } -func (e *S3Bucket) Remove() error { +type S3Bucket struct { + svc *s3.S3 + name string + creationDate time.Time + tags []*s3.Tag +} + +func (e *S3Bucket) Remove(_ context.Context) error { _, err := e.svc.DeleteBucketPolicy(&s3.DeleteBucketPolicyInput{ Bucket: &e.name, }) diff --git a/resources/s3-multipart-uploads.go b/resources/s3-multipart-uploads.go index 254b8343e..7cc3c76ef 100644 --- a/resources/s3-multipart-uploads.go +++ b/resources/s3-multipart-uploads.go @@ -1,29 +1,36 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type S3MultipartUpload struct { - svc *s3.S3 - bucket string - key string - uploadID string -} +const S3MultipartUploadResource = "S3MultipartUpload" func init() { - register("S3MultipartUpload", ListS3MultipartUpload) + resource.Register(resource.Registration{ + Name: S3MultipartUploadResource, + Scope: nuke.Account, + Lister: &S3MultipartUploadLister{}, + }) } -func ListS3MultipartUpload(sess *session.Session) ([]Resource, error) { - svc := s3.New(sess) +type S3MultipartUploadLister struct{} - resources := make([]Resource, 0) +func (l *S3MultipartUploadLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := s3.New(opts.Session) + + resources := make([]resource.Resource, 0) buckets, err := DescribeS3Buckets(svc) if err != nil { @@ -66,7 +73,14 @@ func ListS3MultipartUpload(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *S3MultipartUpload) Remove() error { +type S3MultipartUpload struct { + svc *s3.S3 + bucket string + key string + uploadID string +} + +func (e *S3MultipartUpload) Remove(_ context.Context) error { params := &s3.AbortMultipartUploadInput{ Bucket: &e.bucket, Key: &e.key, diff --git a/resources/s3-objects.go b/resources/s3-objects.go index 675868db3..cf4981814 100644 --- a/resources/s3-objects.go +++ b/resources/s3-objects.go @@ -1,32 +1,39 @@ package resources import ( + "context" + "fmt" "time" + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type S3Object struct { - svc *s3.S3 - bucket string - creationDate time.Time - key string - versionID *string - latest bool -} +const S3ObjectResource = "S3Object" func init() { - register("S3Object", ListS3Objects) + resource.Register(resource.Registration{ + Name: S3ObjectResource, + Scope: nuke.Account, + Lister: &S3ObjectLister{}, + }) } -func ListS3Objects(sess *session.Session) ([]Resource, error) { - svc := s3.New(sess) +type S3ObjectLister struct{} + +func (l *S3ObjectLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := s3.New(opts.Session) - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) buckets, err := DescribeS3Buckets(svc) if err != nil { @@ -55,7 +62,7 @@ func ListS3Objects(sess *session.Session) ([]Resource, error) { creationDate: aws.TimeValue(bucket.CreationDate), key: *out.Key, versionID: out.VersionId, - latest: UnPtrBool(out.IsLatest, false), + latest: ptr.ToBool(out.IsLatest), }) } @@ -70,7 +77,7 @@ func ListS3Objects(sess *session.Session) ([]Resource, error) { creationDate: aws.TimeValue(bucket.CreationDate), key: *out.Key, versionID: out.VersionId, - latest: UnPtrBool(out.IsLatest, false), + latest: ptr.ToBool(out.IsLatest), }) } @@ -87,7 +94,16 @@ func ListS3Objects(sess *session.Session) ([]Resource, error) { return resources, nil } -func (e *S3Object) Remove() error { +type S3Object struct { + svc *s3.S3 + bucket string + creationDate time.Time + key string + versionID *string + latest bool +} + +func (e *S3Object) Remove(_ context.Context) error { params := &s3.DeleteObjectInput{ Bucket: &e.bucket, Key: &e.key, diff --git a/resources/sagemaker-apps.go b/resources/sagemaker-apps.go index ddb8bf067..e2a6afc04 100644 --- a/resources/sagemaker-apps.go +++ b/resources/sagemaker-apps.go @@ -1,30 +1,36 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerApp struct { - svc *sagemaker.SageMaker - domainID *string - appName *string - appType *string - userProfileName *string - status *string -} +const SageMakerAppResource = "SageMakerApp" func init() { - register("SageMakerApp", ListSageMakerApps) + resource.Register(resource.Registration{ + Name: SageMakerAppResource, + Scope: nuke.Account, + Lister: &SageMakerAppLister{}, + }) } -func ListSageMakerApps(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerAppLister struct{} + +func (l *SageMakerAppLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListAppsInput{ MaxResults: aws.Int64(30), @@ -57,7 +63,16 @@ func ListSageMakerApps(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SageMakerApp) Remove() error { +type SageMakerApp struct { + svc *sagemaker.SageMaker + domainID *string + appName *string + appType *string + userProfileName *string + status *string +} + +func (f *SageMakerApp) Remove(_ context.Context) error { _, err := f.svc.DeleteApp(&sagemaker.DeleteAppInput{ DomainId: f.domainID, AppName: f.appName, @@ -72,13 +87,13 @@ func (f *SageMakerApp) String() string { return *f.appName } -func (i *SageMakerApp) Properties() types.Properties { +func (f *SageMakerApp) Properties() types.Properties { properties := types.NewProperties() properties. - Set("DomainID", i.domainID). - Set("AppName", i.appName). - Set("AppType", i.appType). - Set("UserProfileName", i.userProfileName) + Set("DomainID", f.domainID). + Set("AppName", f.appName). + Set("AppType", f.appType). + Set("UserProfileName", f.userProfileName) return properties } diff --git a/resources/sagemaker-domain.go b/resources/sagemaker-domain.go index 58a2344bd..ff80de3ff 100644 --- a/resources/sagemaker-domain.go +++ b/resources/sagemaker-domain.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerDomain struct { - svc *sagemaker.SageMaker - domainID *string -} +const SageMakerDomainResource = "SageMakerDomain" func init() { - register("SageMakerDomain", ListSageMakerDomains) + resource.Register(resource.Registration{ + Name: SageMakerDomainResource, + Scope: nuke.Account, + Lister: &SageMakerDomainLister{}, + }) } -func ListSageMakerDomains(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerDomainLister struct{} + +func (l *SageMakerDomainLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListDomainsInput{ MaxResults: aws.Int64(30), @@ -47,7 +57,12 @@ func ListSageMakerDomains(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SageMakerDomain) Remove() error { +type SageMakerDomain struct { + svc *sagemaker.SageMaker + domainID *string +} + +func (f *SageMakerDomain) Remove(_ context.Context) error { _, err := f.svc.DeleteDomain(&sagemaker.DeleteDomainInput{ DomainId: f.domainID, RetentionPolicy: &sagemaker.RetentionPolicy{HomeEfsFileSystem: aws.String(sagemaker.RetentionTypeDelete)}, @@ -60,9 +75,9 @@ func (f *SageMakerDomain) String() string { return *f.domainID } -func (i *SageMakerDomain) Properties() types.Properties { +func (f *SageMakerDomain) Properties() types.Properties { properties := types.NewProperties() properties. - Set("DomainID", i.domainID) + Set("DomainID", f.domainID) return properties } diff --git a/resources/sagemaker-endpointconfigs.go b/resources/sagemaker-endpointconfigs.go index 8db69e4c5..00c24a447 100644 --- a/resources/sagemaker-endpointconfigs.go +++ b/resources/sagemaker-endpointconfigs.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerEndpointConfig struct { - svc *sagemaker.SageMaker - endpointConfigName *string -} +const SageMakerEndpointConfigResource = "SageMakerEndpointConfig" func init() { - register("SageMakerEndpointConfig", ListSageMakerEndpointConfigs) + resource.Register(resource.Registration{ + Name: SageMakerEndpointConfigResource, + Scope: nuke.Account, + Lister: &SageMakerEndpointConfigLister{}, + }) } -func ListSageMakerEndpointConfigs(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerEndpointConfigLister struct{} + +func (l *SageMakerEndpointConfigLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListEndpointConfigsInput{ MaxResults: aws.Int64(30), @@ -46,8 +56,12 @@ func ListSageMakerEndpointConfigs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SageMakerEndpointConfig) Remove() error { +type SageMakerEndpointConfig struct { + svc *sagemaker.SageMaker + endpointConfigName *string +} +func (f *SageMakerEndpointConfig) Remove(_ context.Context) error { _, err := f.svc.DeleteEndpointConfig(&sagemaker.DeleteEndpointConfigInput{ EndpointConfigName: f.endpointConfigName, }) diff --git a/resources/sagemaker-endpoints.go b/resources/sagemaker-endpoints.go index 649e65af5..892c30138 100644 --- a/resources/sagemaker-endpoints.go +++ b/resources/sagemaker-endpoints.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerEndpoint struct { - svc *sagemaker.SageMaker - endpointName *string -} +const SageMakerEndpointResource = "SageMakerEndpoint" func init() { - register("SageMakerEndpoint", ListSageMakerEndpoints) + resource.Register(resource.Registration{ + Name: SageMakerEndpointResource, + Scope: nuke.Account, + Lister: &SageMakerEndpointLister{}, + }) } -func ListSageMakerEndpoints(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerEndpointLister struct{} + +func (l *SageMakerEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListEndpointsInput{ MaxResults: aws.Int64(30), @@ -46,8 +56,12 @@ func ListSageMakerEndpoints(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SageMakerEndpoint) Remove() error { +type SageMakerEndpoint struct { + svc *sagemaker.SageMaker + endpointName *string +} +func (f *SageMakerEndpoint) Remove(_ context.Context) error { _, err := f.svc.DeleteEndpoint(&sagemaker.DeleteEndpointInput{ EndpointName: f.endpointName, }) diff --git a/resources/sagemaker-models.go b/resources/sagemaker-models.go index 7d08987a5..3a93f28c7 100644 --- a/resources/sagemaker-models.go +++ b/resources/sagemaker-models.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerModel struct { - svc *sagemaker.SageMaker - modelName *string -} +const SageMakerModelResource = "SageMakerModel" func init() { - register("SageMakerModel", ListSageMakerModels) + resource.Register(resource.Registration{ + Name: SageMakerModelResource, + Scope: nuke.Account, + Lister: &SageMakerModelLister{}, + }) } -func ListSageMakerModels(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerModelLister struct{} + +func (l *SageMakerModelLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListModelsInput{ MaxResults: aws.Int64(30), @@ -46,8 +56,12 @@ func ListSageMakerModels(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SageMakerModel) Remove() error { +type SageMakerModel struct { + svc *sagemaker.SageMaker + modelName *string +} +func (f *SageMakerModel) Remove(_ context.Context) error { _, err := f.svc.DeleteModel(&sagemaker.DeleteModelInput{ ModelName: f.modelName, }) diff --git a/resources/sagemaker-notebookinstancelifecycleconfigs.go b/resources/sagemaker-notebook-instancelifecycleconfigs.go similarity index 60% rename from resources/sagemaker-notebookinstancelifecycleconfigs.go rename to resources/sagemaker-notebook-instancelifecycleconfigs.go index 07312b63e..3a524991f 100644 --- a/resources/sagemaker-notebookinstancelifecycleconfigs.go +++ b/resources/sagemaker-notebook-instancelifecycleconfigs.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerNotebookInstanceLifecycleConfig struct { - svc *sagemaker.SageMaker - Name *string -} +const SageMakerNotebookInstanceLifecycleConfigResource = "SageMakerNotebookInstanceLifecycleConfig" func init() { - register("SageMakerNotebookInstanceLifecycleConfig", ListSageMakerNotebookInstanceLifecycleConfigs) + resource.Register(resource.Registration{ + Name: SageMakerNotebookInstanceLifecycleConfigResource, + Scope: nuke.Account, + Lister: &SageMakerNotebookInstanceLifecycleConfigLister{}, + }) } -func ListSageMakerNotebookInstanceLifecycleConfigs(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerNotebookInstanceLifecycleConfigLister struct{} + +func (l *SageMakerNotebookInstanceLifecycleConfigLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListNotebookInstanceLifecycleConfigsInput{ MaxResults: aws.Int64(30), @@ -47,7 +57,12 @@ func ListSageMakerNotebookInstanceLifecycleConfigs(sess *session.Session) ([]Res return resources, nil } -func (f *SageMakerNotebookInstanceLifecycleConfig) Remove() error { +type SageMakerNotebookInstanceLifecycleConfig struct { + svc *sagemaker.SageMaker + Name *string +} + +func (f *SageMakerNotebookInstanceLifecycleConfig) Remove(_ context.Context) error { _, err := f.svc.DeleteNotebookInstanceLifecycleConfig(&sagemaker.DeleteNotebookInstanceLifecycleConfigInput{ NotebookInstanceLifecycleConfigName: f.Name, diff --git a/resources/sagemaker-notebookinstances.go b/resources/sagemaker-notebook-instances.go similarity index 59% rename from resources/sagemaker-notebookinstances.go rename to resources/sagemaker-notebook-instances.go index 7680be2df..c972212d1 100644 --- a/resources/sagemaker-notebookinstances.go +++ b/resources/sagemaker-notebook-instances.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerNotebookInstance struct { - svc *sagemaker.SageMaker - notebookInstanceName *string -} +const SageMakerNotebookInstanceResource = "SageMakerNotebookInstance" func init() { - register("SageMakerNotebookInstance", ListSageMakerNotebookInstances) + resource.Register(resource.Registration{ + Name: SageMakerNotebookInstanceResource, + Scope: nuke.Account, + Lister: &SageMakerNotebookInstanceLister{}, + }) } -func ListSageMakerNotebookInstances(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerNotebookInstanceLister struct{} + +func (l *SageMakerNotebookInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListNotebookInstancesInput{ MaxResults: aws.Int64(30), @@ -46,7 +56,12 @@ func ListSageMakerNotebookInstances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SageMakerNotebookInstance) Remove() error { +type SageMakerNotebookInstance struct { + svc *sagemaker.SageMaker + notebookInstanceName *string +} + +func (f *SageMakerNotebookInstance) Remove(_ context.Context) error { _, err := f.svc.DeleteNotebookInstance(&sagemaker.DeleteNotebookInstanceInput{ NotebookInstanceName: f.notebookInstanceName, }) diff --git a/resources/sagemaker-notebookeinstancestates.go b/resources/sagemaker-notebook-instancestates.go similarity index 64% rename from resources/sagemaker-notebookeinstancestates.go rename to resources/sagemaker-notebook-instancestates.go index 0eaf03512..4547ce3f6 100644 --- a/resources/sagemaker-notebookeinstancestates.go +++ b/resources/sagemaker-notebook-instancestates.go @@ -1,27 +1,36 @@ package resources import ( + "context" + "fmt" "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerNotebookInstanceState struct { - svc *sagemaker.SageMaker - notebookInstanceName *string - instanceStatus *string -} +const SageMakerNotebookInstanceStateResource = "SageMakerNotebookInstanceState" func init() { - register("SageMakerNotebookInstanceState", ListSageMakerNotebookInstanceStates) + resource.Register(resource.Registration{ + Name: SageMakerNotebookInstanceStateResource, + Scope: nuke.Account, + Lister: &SageMakerNotebookInstanceStateLister{}, + }) } -func ListSageMakerNotebookInstanceStates(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerNotebookInstanceStateLister struct{} + +func (l *SageMakerNotebookInstanceStateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListNotebookInstancesInput{ MaxResults: aws.Int64(30), @@ -51,7 +60,13 @@ func ListSageMakerNotebookInstanceStates(sess *session.Session) ([]Resource, err return resources, nil } -func (f *SageMakerNotebookInstanceState) Remove() error { +type SageMakerNotebookInstanceState struct { + svc *sagemaker.SageMaker + notebookInstanceName *string + instanceStatus *string +} + +func (f *SageMakerNotebookInstanceState) Remove(_ context.Context) error { _, err := f.svc.StopNotebookInstance(&sagemaker.StopNotebookInstanceInput{ NotebookInstanceName: f.notebookInstanceName, diff --git a/resources/sagemaker-userprofiles.go b/resources/sagemaker-userprofiles.go index 18a9fa791..94fb2fcb0 100644 --- a/resources/sagemaker-userprofiles.go +++ b/resources/sagemaker-userprofiles.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sagemaker" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SageMakerUserProfile struct { - svc *sagemaker.SageMaker - domainID *string - userProfileName *string -} +const SageMakerUserProfilesResource = "SageMakerUserProfiles" func init() { - register("SageMakerUserProfiles", ListSageMakerUserProfiles) + resource.Register(resource.Registration{ + Name: SageMakerUserProfilesResource, + Scope: nuke.Account, + Lister: &SageMakerUserProfilesLister{}, + }) } -func ListSageMakerUserProfiles(sess *session.Session) ([]Resource, error) { - svc := sagemaker.New(sess) - resources := []Resource{} +type SageMakerUserProfilesLister struct{} + +func (l *SageMakerUserProfilesLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sagemaker.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sagemaker.ListUserProfilesInput{ MaxResults: aws.Int64(30), @@ -49,7 +58,13 @@ func ListSageMakerUserProfiles(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SageMakerUserProfile) Remove() error { +type SageMakerUserProfile struct { + svc *sagemaker.SageMaker + domainID *string + userProfileName *string +} + +func (f *SageMakerUserProfile) Remove(_ context.Context) error { _, err := f.svc.DeleteUserProfile(&sagemaker.DeleteUserProfileInput{ DomainId: f.domainID, UserProfileName: f.userProfileName, @@ -62,10 +77,10 @@ func (f *SageMakerUserProfile) String() string { return *f.userProfileName } -func (i *SageMakerUserProfile) Properties() types.Properties { +func (f *SageMakerUserProfile) Properties() types.Properties { properties := types.NewProperties() properties. - Set("DomainID", i.domainID). - Set("UserProfileName", i.userProfileName) + Set("DomainID", f.domainID). + Set("UserProfileName", f.userProfileName) return properties } diff --git a/resources/secretsmanager-secrets.go b/resources/secretsmanager-secrets.go index a0f615254..88d116674 100644 --- a/resources/secretsmanager-secrets.go +++ b/resources/secretsmanager-secrets.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/secretsmanager" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SecretsManagerSecret struct { - svc *secretsmanager.SecretsManager - ARN *string - tags []*secretsmanager.Tag -} +const SecretsManagerSecretResource = "SecretsManagerSecret" func init() { - register("SecretsManagerSecret", ListSecretsManagerSecrets) + resource.Register(resource.Registration{ + Name: SecretsManagerSecretResource, + Scope: nuke.Account, + Lister: &SecretsManagerSecretLister{}, + }) } -func ListSecretsManagerSecrets(sess *session.Session) ([]Resource, error) { - svc := secretsmanager.New(sess) - resources := []Resource{} +type SecretsManagerSecretLister struct{} + +func (l *SecretsManagerSecretLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := secretsmanager.New(opts.Session) + resources := make([]resource.Resource, 0) params := &secretsmanager.ListSecretsInput{ MaxResults: aws.Int64(100), @@ -49,8 +58,13 @@ func ListSecretsManagerSecrets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SecretsManagerSecret) Remove() error { +type SecretsManagerSecret struct { + svc *secretsmanager.SecretsManager + ARN *string + tags []*secretsmanager.Tag +} +func (f *SecretsManagerSecret) Remove(_ context.Context) error { _, err := f.svc.DeleteSecret(&secretsmanager.DeleteSecretInput{ SecretId: f.ARN, ForceDeleteWithoutRecovery: aws.Bool(true), diff --git a/resources/securityhub-hub.go b/resources/securityhub-hub.go index cb8210462..e2c88cad9 100644 --- a/resources/securityhub-hub.go +++ b/resources/securityhub-hub.go @@ -1,49 +1,65 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/securityhub" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/awsutil" + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const SecurityHubResource = "SecurityHub" + func init() { - register("SecurityHub", ListHubs) + resource.Register(resource.Registration{ + Name: SecurityHubResource, + Scope: nuke.Account, + Lister: &SecurityHubLister{}, + }) } -func ListHubs(sess *session.Session) ([]Resource, error) { - svc := securityhub.New(sess) +type SecurityHubLister struct{} + +func (l *SecurityHubLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := securityhub.New(opts.Session) - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) resp, err := svc.DescribeHub(nil) if err != nil { - if IsAWSError(err, securityhub.ErrCodeInvalidAccessException) { - // Security Hub is not enabled for this region + if awsutil.IsAWSError(err, securityhub.ErrCodeInvalidAccessException) { + // Security SecurityHub is not enabled for this region return resources, nil } return nil, err } - resources = append(resources, &Hub{ + resources = append(resources, &SecurityHub{ svc: svc, id: resp.HubArn, }) return resources, nil } -type Hub struct { +type SecurityHub struct { svc *securityhub.SecurityHub id *string } -func (hub *Hub) Properties() types.Properties { +func (hub *SecurityHub) Properties() types.Properties { properties := types.NewProperties() properties.Set("Arn", hub.id) return properties } -func (hub *Hub) Remove() error { +func (hub *SecurityHub) Remove(_ context.Context) error { _, err := hub.svc.DisableSecurityHub(&securityhub.DisableSecurityHubInput{}) return err } diff --git a/resources/servicecatalog-portfolio-constraints-attachements.go b/resources/servicecatalog-portfolio-constraints-attachments.go similarity index 65% rename from resources/servicecatalog-portfolio-constraints-attachements.go rename to resources/servicecatalog-portfolio-constraints-attachments.go index d6398497d..07333ca75 100644 --- a/resources/servicecatalog-portfolio-constraints-attachements.go +++ b/resources/servicecatalog-portfolio-constraints-attachments.go @@ -1,30 +1,40 @@ package resources import ( + "context" + "fmt" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - log "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/awsutil" + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogConstraintPortfolioAttachment struct { - svc *servicecatalog.ServiceCatalog - constraintID *string - portfolioID *string - portfolioName *string -} +const ServiceCatalogConstraintPortfolioAttachmentResource = "ServiceCatalogConstraintPortfolioAttachment" func init() { - register("ServiceCatalogConstraintPortfolioAttachment", ListServiceCatalogPrincipalProductAttachments) + resource.Register(resource.Registration{ + Name: ServiceCatalogConstraintPortfolioAttachmentResource, + Scope: nuke.Account, + Lister: &ServiceCatalogConstraintPortfolioAttachmentLister{}, + }) } -func ListServiceCatalogPrincipalProductAttachments(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} - portfolios := []*servicecatalog.PortfolioDetail{} +type ServiceCatalogConstraintPortfolioAttachmentLister struct{} + +func (l *ServiceCatalogConstraintPortfolioAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) + var portfolios []*servicecatalog.PortfolioDetail params := &servicecatalog.ListPortfoliosInput{ PageSize: aws.Int64(20), @@ -34,8 +44,8 @@ func ListServiceCatalogPrincipalProductAttachments(sess *session.Session) ([]Res for { resp, err := svc.ListPortfolios(params) if err != nil { - if IsAWSError(err, servicecatalog.ErrCodeTagOptionNotMigratedException) { - log.Info(err) + if awsutil.IsAWSError(err, servicecatalog.ErrCodeTagOptionNotMigratedException) { + logrus.Info(err) break } return nil, err @@ -83,8 +93,14 @@ func ListServiceCatalogPrincipalProductAttachments(sess *session.Session) ([]Res return resources, nil } -func (f *ServiceCatalogConstraintPortfolioAttachment) Remove() error { +type ServiceCatalogConstraintPortfolioAttachment struct { + svc *servicecatalog.ServiceCatalog + constraintID *string + portfolioID *string + portfolioName *string +} +func (f *ServiceCatalogConstraintPortfolioAttachment) Remove(_ context.Context) error { _, err := f.svc.DeleteConstraint(&servicecatalog.DeleteConstraintInput{ Id: f.constraintID, }) diff --git a/resources/servicecatalog-portfolio-principal-attachements.go b/resources/servicecatalog-portfolio-principal-attachments.go similarity index 68% rename from resources/servicecatalog-portfolio-principal-attachements.go rename to resources/servicecatalog-portfolio-principal-attachments.go index 87e915d45..70a969b40 100644 --- a/resources/servicecatalog-portfolio-principal-attachements.go +++ b/resources/servicecatalog-portfolio-principal-attachments.go @@ -1,35 +1,43 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogPrincipalPortfolioAttachment struct { - svc *servicecatalog.ServiceCatalog - portfolioID *string - principalARN *string - portfolioName *string -} +const ServiceCatalogPrincipalPortfolioAttachmentResource = "ServiceCatalogPrincipalPortfolioAttachment" func init() { - register("ServiceCatalogPrincipalPortfolioAttachment", ListServiceCatalogPrincipalPortfolioAttachments) + resource.Register(resource.Registration{ + Name: ServiceCatalogPrincipalPortfolioAttachmentResource, + Scope: nuke.Account, + Lister: &ServiceCatalogPrincipalPortfolioAttachmentLister{}, + }) } -func ListServiceCatalogPrincipalPortfolioAttachments(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} - portfolios := []*servicecatalog.PortfolioDetail{} +type ServiceCatalogPrincipalPortfolioAttachmentLister struct{} + +func (l *ServiceCatalogPrincipalPortfolioAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) + var portfolios []*servicecatalog.PortfolioDetail params := &servicecatalog.ListPortfoliosInput{ PageSize: aws.Int64(20), } - //List all Portfolios + // List all Portfolios for { resp, err := svc.ListPortfolios(params) if err != nil { @@ -52,7 +60,6 @@ func ListServiceCatalogPrincipalPortfolioAttachments(sess *session.Session) ([]R } for _, portfolio := range portfolios { - principalParams.PortfolioId = portfolio.Id resp, err := svc.ListPrincipalsForPortfolio(principalParams) @@ -79,8 +86,14 @@ func ListServiceCatalogPrincipalPortfolioAttachments(sess *session.Session) ([]R return resources, nil } -func (f *ServiceCatalogPrincipalPortfolioAttachment) Remove() error { +type ServiceCatalogPrincipalPortfolioAttachment struct { + svc *servicecatalog.ServiceCatalog + portfolioID *string + principalARN *string + portfolioName *string +} +func (f *ServiceCatalogPrincipalPortfolioAttachment) Remove(_ context.Context) error { _, err := f.svc.DisassociatePrincipalFromPortfolio(&servicecatalog.DisassociatePrincipalFromPortfolioInput{ PrincipalARN: f.principalARN, PortfolioId: f.portfolioID, diff --git a/resources/servicecatalog-portfolio-product-attachements.go b/resources/servicecatalog-portfolio-product-attachments.go similarity index 71% rename from resources/servicecatalog-portfolio-product-attachements.go rename to resources/servicecatalog-portfolio-product-attachments.go index 94f2b5bdb..3c8ad6502 100644 --- a/resources/servicecatalog-portfolio-product-attachements.go +++ b/resources/servicecatalog-portfolio-product-attachments.go @@ -1,36 +1,43 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogPortfolioProductAttachment struct { - svc *servicecatalog.ServiceCatalog - productID *string - portfolioID *string - portfolioName *string - productName *string -} +const ServiceCatalogPortfolioProductAttachmentResource = "ServiceCatalogPortfolioProductAttachment" func init() { - register("ServiceCatalogPortfolioProductAttachment", ListServiceCatalogPortfolioProductAttachments) + resource.Register(resource.Registration{ + Name: ServiceCatalogPortfolioProductAttachmentResource, + Scope: nuke.Account, + Lister: &ServiceCatalogPortfolioProductAttachmentLister{}, + }) } -func ListServiceCatalogPortfolioProductAttachments(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} +type ServiceCatalogPortfolioProductAttachmentLister struct{} + +func (l *ServiceCatalogPortfolioProductAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) products := make(map[*string]*string) params := &servicecatalog.SearchProductsAsAdminInput{ PageSize: aws.Int64(20), } - //List all Products and then search assigned portfolios + // List all Products and then search assigned portfolios for { resp, err := svc.SearchProductsAsAdmin(params) if err != nil { @@ -81,8 +88,15 @@ func ListServiceCatalogPortfolioProductAttachments(sess *session.Session) ([]Res return resources, nil } -func (f *ServiceCatalogPortfolioProductAttachment) Remove() error { +type ServiceCatalogPortfolioProductAttachment struct { + svc *servicecatalog.ServiceCatalog + productID *string + portfolioID *string + portfolioName *string + productName *string +} +func (f *ServiceCatalogPortfolioProductAttachment) Remove(_ context.Context) error { _, err := f.svc.DisassociateProductFromPortfolio(&servicecatalog.DisassociateProductFromPortfolioInput{ ProductId: f.productID, PortfolioId: f.portfolioID, diff --git a/resources/servicecatalog-portfolio-share-attachements.go b/resources/servicecatalog-portfolio-share-attachments.go similarity index 68% rename from resources/servicecatalog-portfolio-share-attachements.go rename to resources/servicecatalog-portfolio-share-attachments.go index bef7620c8..cfdcaa9d7 100644 --- a/resources/servicecatalog-portfolio-share-attachements.go +++ b/resources/servicecatalog-portfolio-share-attachments.go @@ -1,29 +1,37 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogPortfolioShareAttachment struct { - svc *servicecatalog.ServiceCatalog - portfolioID *string - accountID *string - portfolioName *string -} +const ServiceCatalogPortfolioShareAttachmentResource = "ServiceCatalogPortfolioShareAttachment" func init() { - register("ServiceCatalogPortfolioShareAttachment", ListServiceCatalogPortfolioShareAttachments) + resource.Register(resource.Registration{ + Name: ServiceCatalogPortfolioShareAttachmentResource, + Scope: nuke.Account, + Lister: &ServiceCatalogPortfolioShareAttachmentLister{}, + }) } -func ListServiceCatalogPortfolioShareAttachments(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} - portfolios := []*servicecatalog.PortfolioDetail{} +type ServiceCatalogPortfolioShareAttachmentLister struct{} + +func (l *ServiceCatalogPortfolioShareAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) + var portfolios []*servicecatalog.PortfolioDetail params := &servicecatalog.ListPortfoliosInput{ PageSize: aws.Int64(20), @@ -73,8 +81,14 @@ func ListServiceCatalogPortfolioShareAttachments(sess *session.Session) ([]Resou return resources, nil } -func (f *ServiceCatalogPortfolioShareAttachment) Remove() error { +type ServiceCatalogPortfolioShareAttachment struct { + svc *servicecatalog.ServiceCatalog + portfolioID *string + accountID *string + portfolioName *string +} +func (f *ServiceCatalogPortfolioShareAttachment) Remove(_ context.Context) error { _, err := f.svc.DeletePortfolioShare(&servicecatalog.DeletePortfolioShareInput{ AccountId: f.accountID, PortfolioId: f.portfolioID, diff --git a/resources/servicecatalog-portfolio-tagoptions-attachements.go b/resources/servicecatalog-portfolio-tagoptions-attachements.go index 3192982a2..f233e6ed1 100644 --- a/resources/servicecatalog-portfolio-tagoptions-attachements.go +++ b/resources/servicecatalog-portfolio-tagoptions-attachements.go @@ -1,32 +1,40 @@ package resources import ( + "context" + "fmt" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - log "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/awsutil" + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogTagOptionPortfolioAttachment struct { - svc *servicecatalog.ServiceCatalog - tagOptionID *string - resourceID *string - tagOptionKey *string - tagOptionValue *string - resourceName *string -} +const ServiceCatalogTagOptionPortfolioAttachmentResource = "ServiceCatalogTagOptionPortfolioAttachment" func init() { - register("ServiceCatalogTagOptionPortfolioAttachment", ListServiceCatalogTagOptionPortfolioAttachments) + resource.Register(resource.Registration{ + Name: ServiceCatalogTagOptionPortfolioAttachmentResource, + Scope: nuke.Account, + Lister: &ServiceCatalogTagOptionPortfolioAttachmentLister{}, + }) } -func ListServiceCatalogTagOptionPortfolioAttachments(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} - tagOptions := []*servicecatalog.TagOptionDetail{} +type ServiceCatalogTagOptionPortfolioAttachmentLister struct{} + +func (l *ServiceCatalogTagOptionPortfolioAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) + var tagOptions []*servicecatalog.TagOptionDetail params := &servicecatalog.ListTagOptionsInput{ PageSize: aws.Int64(20), @@ -36,8 +44,8 @@ func ListServiceCatalogTagOptionPortfolioAttachments(sess *session.Session) ([]R for { resp, err := svc.ListTagOptions(params) if err != nil { - if IsAWSError(err, servicecatalog.ErrCodeTagOptionNotMigratedException) { - log.Info(err) + if awsutil.IsAWSError(err, servicecatalog.ErrCodeTagOptionNotMigratedException) { + logrus.Info(err) break } return nil, err @@ -87,8 +95,16 @@ func ListServiceCatalogTagOptionPortfolioAttachments(sess *session.Session) ([]R return resources, nil } -func (f *ServiceCatalogTagOptionPortfolioAttachment) Remove() error { +type ServiceCatalogTagOptionPortfolioAttachment struct { + svc *servicecatalog.ServiceCatalog + tagOptionID *string + resourceID *string + tagOptionKey *string + tagOptionValue *string + resourceName *string +} +func (f *ServiceCatalogTagOptionPortfolioAttachment) Remove(_ context.Context) error { _, err := f.svc.DisassociateTagOptionFromResource(&servicecatalog.DisassociateTagOptionFromResourceInput{ TagOptionId: f.tagOptionID, ResourceId: f.resourceID, diff --git a/resources/servicecatalog-portfolios.go b/resources/servicecatalog-portfolios.go index b208fe433..4e3887133 100644 --- a/resources/servicecatalog-portfolios.go +++ b/resources/servicecatalog-portfolios.go @@ -1,26 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogPortfolio struct { - svc *servicecatalog.ServiceCatalog - ID *string - displayName *string - providerName *string -} +const ServiceCatalogPortfolioResource = "ServiceCatalogPortfolio" func init() { - register("ServiceCatalogPortfolio", ListServiceCatalogPortfolios) + resource.Register(resource.Registration{ + Name: ServiceCatalogPortfolioResource, + Scope: nuke.Account, + Lister: &ServiceCatalogPortfolioLister{}, + }) } -func ListServiceCatalogPortfolios(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} +type ServiceCatalogPortfolioLister struct{} + +func (l *ServiceCatalogPortfolioLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) params := &servicecatalog.ListPortfoliosInput{ PageSize: aws.Int64(20), @@ -51,8 +59,14 @@ func ListServiceCatalogPortfolios(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ServiceCatalogPortfolio) Remove() error { +type ServiceCatalogPortfolio struct { + svc *servicecatalog.ServiceCatalog + ID *string + displayName *string + providerName *string +} +func (f *ServiceCatalogPortfolio) Remove(_ context.Context) error { _, err := f.svc.DeletePortfolio(&servicecatalog.DeletePortfolioInput{ Id: f.ID, }) diff --git a/resources/servicecatalog-products.go b/resources/servicecatalog-products.go index c48cdf51f..b0356a16d 100644 --- a/resources/servicecatalog-products.go +++ b/resources/servicecatalog-products.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogProduct struct { - svc *servicecatalog.ServiceCatalog - ID *string - name *string -} +const ServiceCatalogProductResource = "ServiceCatalogProduct" func init() { - register("ServiceCatalogProduct", ListServiceCatalogProducts) + resource.Register(resource.Registration{ + Name: ServiceCatalogProductResource, + Scope: nuke.Account, + Lister: &ServiceCatalogProductLister{}, + }) } -func ListServiceCatalogProducts(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} +type ServiceCatalogProductLister struct{} + +func (l *ServiceCatalogProductLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) params := &servicecatalog.SearchProductsAsAdminInput{ PageSize: aws.Int64(20), @@ -49,8 +58,13 @@ func ListServiceCatalogProducts(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ServiceCatalogProduct) Remove() error { +type ServiceCatalogProduct struct { + svc *servicecatalog.ServiceCatalog + ID *string + name *string +} +func (f *ServiceCatalogProduct) Remove(_ context.Context) error { _, err := f.svc.DeleteProduct(&servicecatalog.DeleteProductInput{ Id: f.ID, }) diff --git a/resources/servicecatalog-provisionedproducts.go b/resources/servicecatalog-provisionedproducts.go index 69a5dca26..0424a4ecc 100644 --- a/resources/servicecatalog-provisionedproducts.go +++ b/resources/servicecatalog-provisionedproducts.go @@ -1,27 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogProvisionedProduct struct { - svc *servicecatalog.ServiceCatalog - ID *string - terminateToken *string - name *string - productID *string -} +const ServiceCatalogProvisionedProductResource = "ServiceCatalogProvisionedProduct" func init() { - register("ServiceCatalogProvisionedProduct", ListServiceCatalogProvisionedProducts) + resource.Register(resource.Registration{ + Name: ServiceCatalogProvisionedProductResource, + Scope: nuke.Account, + Lister: &ServiceCatalogProvisionedProductLister{}, + }) } -func ListServiceCatalogProvisionedProducts(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} +type ServiceCatalogProvisionedProductLister struct{} + +func (l *ServiceCatalogProvisionedProductLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) params := &servicecatalog.ScanProvisionedProductsInput{ PageSize: aws.Int64(20), @@ -57,8 +64,15 @@ func ListServiceCatalogProvisionedProducts(sess *session.Session) ([]Resource, e return resources, nil } -func (f *ServiceCatalogProvisionedProduct) Remove() error { +type ServiceCatalogProvisionedProduct struct { + svc *servicecatalog.ServiceCatalog + ID *string + terminateToken *string + name *string + productID *string +} +func (f *ServiceCatalogProvisionedProduct) Remove(_ context.Context) error { _, err := f.svc.TerminateProvisionedProduct(&servicecatalog.TerminateProvisionedProductInput{ ProvisionedProductId: f.ID, IgnoreErrors: aws.Bool(true), diff --git a/resources/servicecatalog-tagoptions.go b/resources/servicecatalog-tagoptions.go index 1b509efd9..398603b34 100644 --- a/resources/servicecatalog-tagoptions.go +++ b/resources/servicecatalog-tagoptions.go @@ -1,27 +1,37 @@ package resources import ( + "context" + + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicecatalog" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" - log "github.com/sirupsen/logrus" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/awsutil" + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceCatalogTagOption struct { - svc *servicecatalog.ServiceCatalog - ID *string - key *string - value *string -} +const ServiceCatalogTagOptionResource = "ServiceCatalogTagOption" func init() { - register("ServiceCatalogTagOption", ListServiceCatalogTagOptions) + resource.Register(resource.Registration{ + Name: ServiceCatalogTagOptionResource, + Scope: nuke.Account, + Lister: &ServiceCatalogTagOptionLister{}, + }) } -func ListServiceCatalogTagOptions(sess *session.Session) ([]Resource, error) { - svc := servicecatalog.New(sess) - resources := []Resource{} +type ServiceCatalogTagOptionLister struct{} + +func (l *ServiceCatalogTagOptionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicecatalog.New(opts.Session) + resources := make([]resource.Resource, 0) params := &servicecatalog.ListTagOptionsInput{ PageSize: aws.Int64(20), @@ -30,8 +40,8 @@ func ListServiceCatalogTagOptions(sess *session.Session) ([]Resource, error) { for { resp, err := svc.ListTagOptions(params) if err != nil { - if IsAWSError(err, servicecatalog.ErrCodeTagOptionNotMigratedException) { - log.Info(err) + if awsutil.IsAWSError(err, servicecatalog.ErrCodeTagOptionNotMigratedException) { + logrus.Info(err) break } return nil, err @@ -56,8 +66,14 @@ func ListServiceCatalogTagOptions(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ServiceCatalogTagOption) Remove() error { +type ServiceCatalogTagOption struct { + svc *servicecatalog.ServiceCatalog + ID *string + key *string + value *string +} +func (f *ServiceCatalogTagOption) Remove(_ context.Context) error { _, err := f.svc.DeleteTagOption(&servicecatalog.DeleteTagOptionInput{ Id: f.ID, }) diff --git a/resources/servicediscovery-instances.go b/resources/servicediscovery-instances.go index 09db483a4..90e74a8d1 100644 --- a/resources/servicediscovery-instances.go +++ b/resources/servicediscovery-instances.go @@ -1,27 +1,36 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicediscovery" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceDiscoveryInstance struct { - svc *servicediscovery.ServiceDiscovery - serviceID *string - instanceID *string -} +const ServiceDiscoveryInstanceResource = "ServiceDiscoveryInstance" func init() { - register("ServiceDiscoveryInstance", ListServiceDiscoveryInstances) + resource.Register(resource.Registration{ + Name: ServiceDiscoveryInstanceResource, + Scope: nuke.Account, + Lister: &ServiceDiscoveryInstanceLister{}, + }) } -func ListServiceDiscoveryInstances(sess *session.Session) ([]Resource, error) { - svc := servicediscovery.New(sess) - resources := []Resource{} - services := []*servicediscovery.ServiceSummary{} +type ServiceDiscoveryInstanceLister struct{} + +func (l *ServiceDiscoveryInstanceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicediscovery.New(opts.Session) + resources := make([]resource.Resource, 0) + var services []*servicediscovery.ServiceSummary params := &servicediscovery.ListServicesInput{ MaxResults: aws.Int64(100), @@ -75,8 +84,13 @@ func ListServiceDiscoveryInstances(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ServiceDiscoveryInstance) Remove() error { +type ServiceDiscoveryInstance struct { + svc *servicediscovery.ServiceDiscovery + serviceID *string + instanceID *string +} +func (f *ServiceDiscoveryInstance) Remove(_ context.Context) error { _, err := f.svc.DeregisterInstance(&servicediscovery.DeregisterInstanceInput{ InstanceId: f.instanceID, ServiceId: f.serviceID, diff --git a/resources/servicediscovery-namespaces.go b/resources/servicediscovery-namespaces.go index 42fe7714e..d4d84e40c 100644 --- a/resources/servicediscovery-namespaces.go +++ b/resources/servicediscovery-namespaces.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicediscovery" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceDiscoveryNamespace struct { - svc *servicediscovery.ServiceDiscovery - ID *string -} +const ServiceDiscoveryNamespaceResource = "ServiceDiscoveryNamespace" func init() { - register("ServiceDiscoveryNamespace", ListServiceDiscoveryNamespaces) + resource.Register(resource.Registration{ + Name: ServiceDiscoveryNamespaceResource, + Scope: nuke.Account, + Lister: &ServiceDiscoveryNamespaceLister{}, + }) } -func ListServiceDiscoveryNamespaces(sess *session.Session) ([]Resource, error) { - svc := servicediscovery.New(sess) - resources := []Resource{} +type ServiceDiscoveryNamespaceLister struct{} + +func (l *ServiceDiscoveryNamespaceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicediscovery.New(opts.Session) + resources := make([]resource.Resource, 0) params := &servicediscovery.ListNamespacesInput{ MaxResults: aws.Int64(100), @@ -48,8 +58,12 @@ func ListServiceDiscoveryNamespaces(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ServiceDiscoveryNamespace) Remove() error { +type ServiceDiscoveryNamespace struct { + svc *servicediscovery.ServiceDiscovery + ID *string +} +func (f *ServiceDiscoveryNamespace) Remove(_ context.Context) error { _, err := f.svc.DeleteNamespace(&servicediscovery.DeleteNamespaceInput{ Id: f.ID, }) diff --git a/resources/servicediscovery-services.go b/resources/servicediscovery-services.go index a53566c00..a0b0dd477 100644 --- a/resources/servicediscovery-services.go +++ b/resources/servicediscovery-services.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/servicediscovery" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type ServiceDiscoveryService struct { - svc *servicediscovery.ServiceDiscovery - ID *string -} +const ServiceDiscoveryServiceResource = "ServiceDiscoveryService" func init() { - register("ServiceDiscoveryService", ListServiceDiscoveryServices) + resource.Register(resource.Registration{ + Name: ServiceDiscoveryServiceResource, + Scope: nuke.Account, + Lister: &ServiceDiscoveryServiceLister{}, + }) } -func ListServiceDiscoveryServices(sess *session.Session) ([]Resource, error) { - svc := servicediscovery.New(sess) - resources := []Resource{} +type ServiceDiscoveryServiceLister struct{} + +func (l *ServiceDiscoveryServiceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := servicediscovery.New(opts.Session) + resources := make([]resource.Resource, 0) params := &servicediscovery.ListServicesInput{ MaxResults: aws.Int64(100), @@ -48,8 +58,12 @@ func ListServiceDiscoveryServices(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *ServiceDiscoveryService) Remove() error { +type ServiceDiscoveryService struct { + svc *servicediscovery.ServiceDiscovery + ID *string +} +func (f *ServiceDiscoveryService) Remove(_ context.Context) error { _, err := f.svc.DeleteService(&servicediscovery.DeleteServiceInput{ Id: f.ID, }) diff --git a/resources/ses-configurationsets.go b/resources/ses-configurationsets.go index e4b963d7d..fb2551fa3 100644 --- a/resources/ses-configurationsets.go +++ b/resources/ses-configurationsets.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ses" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SESConfigurationSet struct { - svc *ses.SES - name *string -} +const SESConfigurationSetResource = "SESConfigurationSet" func init() { - register("SESConfigurationSet", ListSESConfigurationSets) + resource.Register(resource.Registration{ + Name: SESConfigurationSetResource, + Scope: nuke.Account, + Lister: &SESConfigurationSetLister{}, + }) } -func ListSESConfigurationSets(sess *session.Session) ([]Resource, error) { - svc := ses.New(sess) - resources := []Resource{} +type SESConfigurationSetLister struct{} + +func (l *SESConfigurationSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ses.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ses.ListConfigurationSetsInput{ MaxItems: aws.Int64(100), @@ -46,8 +56,12 @@ func ListSESConfigurationSets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SESConfigurationSet) Remove() error { +type SESConfigurationSet struct { + svc *ses.SES + name *string +} +func (f *SESConfigurationSet) Remove(_ context.Context) error { _, err := f.svc.DeleteConfigurationSet(&ses.DeleteConfigurationSetInput{ ConfigurationSetName: f.name, }) diff --git a/resources/ses-identities.go b/resources/ses-identities.go index c8d01064c..d5bb49584 100644 --- a/resources/ses-identities.go +++ b/resources/ses-identities.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ses" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SESIdentity struct { - svc *ses.SES - identity *string -} +const SESIdentityResource = "SESIdentity" func init() { - register("SESIdentity", ListSESIdentities) + resource.Register(resource.Registration{ + Name: SESIdentityResource, + Scope: nuke.Account, + Lister: &SESIdentityLister{}, + }) } -func ListSESIdentities(sess *session.Session) ([]Resource, error) { - svc := ses.New(sess) - resources := []Resource{} +type SESIdentityLister struct{} + +func (l *SESIdentityLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ses.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ses.ListIdentitiesInput{ MaxItems: aws.Int64(100), @@ -46,8 +56,12 @@ func ListSESIdentities(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SESIdentity) Remove() error { +type SESIdentity struct { + svc *ses.SES + identity *string +} +func (f *SESIdentity) Remove(_ context.Context) error { _, err := f.svc.DeleteIdentity(&ses.DeleteIdentityInput{ Identity: f.identity, }) diff --git a/resources/ses-receiptfilters.go b/resources/ses-receiptfilters.go index d841eb092..880f0a7c2 100644 --- a/resources/ses-receiptfilters.go +++ b/resources/ses-receiptfilters.go @@ -1,27 +1,52 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "errors" + + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ses" + + sdkerrors "github.com/ekristen/libnuke/pkg/errors" + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SESReceiptFilter struct { - svc *ses.SES - name *string -} +const SESReceiptFilterResource = "SESReceiptFilter" func init() { - register("SESReceiptFilter", ListSESReceiptFilters) + resource.Register(resource.Registration{ + Name: SESReceiptFilterResource, + Scope: nuke.Account, + Lister: &SESReceiptFilterLister{}, + }) } -func ListSESReceiptFilters(sess *session.Session) ([]Resource, error) { - svc := ses.New(sess) - resources := []Resource{} +type SESReceiptFilterLister struct{} + +func (l *SESReceiptFilterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ses.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ses.ListReceiptFiltersInput{} output, err := svc.ListReceiptFilters(params) if err != nil { + // SES capabilities aren't the same in all regions, for example us-west-1 will throw InvalidAction + // errors, but other regions work, this allows us to safely ignore these and yet log them in debug logs + // should we need to troubleshoot. + var awsError awserr.Error + if errors.As(err, &awsError) { + if awsError.Code() == "InvalidAction" { + return nil, sdkerrors.ErrSkipRequest( + "Listing of SESReceiptFilter not supported in this region: " + *opts.Session.Config.Region) + } + } + return nil, err } @@ -35,8 +60,12 @@ func ListSESReceiptFilters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SESReceiptFilter) Remove() error { +type SESReceiptFilter struct { + svc *ses.SES + name *string +} +func (f *SESReceiptFilter) Remove(_ context.Context) error { _, err := f.svc.DeleteReceiptFilter(&ses.DeleteReceiptFilterInput{ FilterName: f.name, }) diff --git a/resources/ses-receiptrulesets.go b/resources/ses-receiptrulesets.go index 562dda428..a4f627423 100644 --- a/resources/ses-receiptrulesets.go +++ b/resources/ses-receiptrulesets.go @@ -1,36 +1,58 @@ package resources import ( + "context" + + "errors" "fmt" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ses" + + sdkerrors "github.com/ekristen/libnuke/pkg/errors" + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SESReceiptRuleSet struct { - svc *ses.SES - name *string - activeRuleSet bool -} +const SESReceiptRuleSetResource = "SESReceiptRuleSet" func init() { - register("SESReceiptRuleSet", ListSESReceiptRuleSets) + resource.Register(resource.Registration{ + Name: SESReceiptRuleSetResource, + Scope: nuke.Account, + Lister: &SESReceiptRuleSetLister{}, + }) } -func ListSESReceiptRuleSets(sess *session.Session) ([]Resource, error) { - svc := ses.New(sess) - resources := []Resource{} +type SESReceiptRuleSetLister struct{} + +func (l *SESReceiptRuleSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ses.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ses.ListReceiptRuleSetsInput{} output, err := svc.ListReceiptRuleSets(params) if err != nil { + // SES capabilities aren't the same in all regions, for example us-west-1 will throw InvalidAction + // errors, but other regions work, this allows us to safely ignore these and yet log them in debug logs + // should we need to troubleshoot. + var awsError awserr.Error + if errors.As(err, &awsError) { + if awsError.Code() == "InvalidAction" { + return nil, sdkerrors.ErrSkipRequest( + "Listing of SESReceiptFilter not supported in this region: " + *opts.Session.Config.Region) + } + } + return nil, err } for _, ruleSet := range output.RuleSets { - - //Check active state + // Check active state ruleSetState := false ruleName := ruleSet.Name @@ -54,8 +76,20 @@ func ListSESReceiptRuleSets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SESReceiptRuleSet) Remove() error { +type SESReceiptRuleSet struct { + svc *ses.SES + name *string + activeRuleSet bool +} + +func (f *SESReceiptRuleSet) Filter() error { + if f.activeRuleSet == true { + return fmt.Errorf("cannot delete active ruleset") + } + return nil +} +func (f *SESReceiptRuleSet) Remove(_ context.Context) error { _, err := f.svc.DeleteReceiptRuleSet(&ses.DeleteReceiptRuleSetInput{ RuleSetName: f.name, }) @@ -66,10 +100,3 @@ func (f *SESReceiptRuleSet) Remove() error { func (f *SESReceiptRuleSet) String() string { return *f.name } - -func (f *SESReceiptRuleSet) Filter() error { - if f.activeRuleSet == true { - return fmt.Errorf("cannot delete active ruleset") - } - return nil -} diff --git a/resources/ses-templates.go b/resources/ses-templates.go index 43ac4c57d..b12c028fb 100644 --- a/resources/ses-templates.go +++ b/resources/ses-templates.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ses" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SESTemplate struct { - svc *ses.SES - name *string -} +const SESTemplateResource = "SESTemplate" func init() { - register("SESTemplate", ListSESTemplates) + resource.Register(resource.Registration{ + Name: SESTemplateResource, + Scope: nuke.Account, + Lister: &SESTemplateLister{}, + }) } -func ListSESTemplates(sess *session.Session) ([]Resource, error) { - svc := ses.New(sess) - resources := []Resource{} +type SESTemplateLister struct{} + +func (l *SESTemplateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ses.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ses.ListTemplatesInput{ MaxItems: aws.Int64(100), @@ -46,8 +56,12 @@ func ListSESTemplates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SESTemplate) Remove() error { +type SESTemplate struct { + svc *ses.SES + name *string +} +func (f *SESTemplate) Remove(_ context.Context) error { _, err := f.svc.DeleteTemplate(&ses.DeleteTemplateInput{ TemplateName: f.name, }) diff --git a/resources/sfn-statemachines.go b/resources/sfn-statemachines.go index e0748f7a4..b80c85b39 100644 --- a/resources/sfn-statemachines.go +++ b/resources/sfn-statemachines.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sfn" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SFNStateMachine struct { - svc *sfn.SFN - ARN *string -} +const SFNStateMachineResource = "SFNStateMachine" func init() { - register("SFNStateMachine", ListSFNStateMachines) + resource.Register(resource.Registration{ + Name: SFNStateMachineResource, + Scope: nuke.Account, + Lister: &SFNStateMachineLister{}, + }) } -func ListSFNStateMachines(sess *session.Session) ([]Resource, error) { - svc := sfn.New(sess) - resources := []Resource{} +type SFNStateMachineLister struct{} + +func (l *SFNStateMachineLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sfn.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sfn.ListStateMachinesInput{ MaxResults: aws.Int64(100), @@ -46,8 +56,12 @@ func ListSFNStateMachines(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SFNStateMachine) Remove() error { +type SFNStateMachine struct { + svc *sfn.SFN + ARN *string +} +func (f *SFNStateMachine) Remove(_ context.Context) error { _, err := f.svc.DeleteStateMachine(&sfn.DeleteStateMachineInput{ StateMachineArn: f.ARN, }) diff --git a/resources/signer.signingjobs.go b/resources/signer-signingjobs.go similarity index 79% rename from resources/signer.signingjobs.go rename to resources/signer-signingjobs.go index bc9f88c54..686af9f40 100644 --- a/resources/signer.signingjobs.go +++ b/resources/signer-signingjobs.go @@ -1,36 +1,37 @@ package resources import ( + "context" + "fmt" "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/signer" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SignerSigningJob struct { - svc *signer.Signer - jobId *string - reason string - isRevoked *bool - createdAt time.Time - profileName *string - profileVersion *string - platformId *string - platformDisplayName *string - jobOwner *string - jobInvoker *string -} +const SignerSigningJobResource = "SignerSigningJob" func init() { - register("SignerSigningJob", ListSignerSigningJobs) + resource.Register(resource.Registration{ + Name: SignerSigningJobResource, + Scope: nuke.Account, + Lister: &SignerSigningJobLister{}, + }) } -func ListSignerSigningJobs(sess *session.Session) ([]Resource, error) { - svc := signer.New(sess) - resources := []Resource{} +type SignerSigningJobLister struct{} + +func (l *SignerSigningJobLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := signer.New(opts.Session) + resources := make([]resource.Resource, 0) const reason string = "Revoked by AWS Nuke" listJobsInput := &signer.ListSigningJobsInput{} @@ -59,6 +60,20 @@ func ListSignerSigningJobs(sess *session.Session) ([]Resource, error) { return resources, nil } +type SignerSigningJob struct { + svc *signer.Signer + jobId *string + reason string + isRevoked *bool + createdAt time.Time + profileName *string + profileVersion *string + platformId *string + platformDisplayName *string + jobOwner *string + jobInvoker *string +} + func (j *SignerSigningJob) Filter() error { // Consider all non-revoked jobs if *j.isRevoked { @@ -67,7 +82,7 @@ func (j *SignerSigningJob) Filter() error { return nil } -func (j *SignerSigningJob) Remove() error { +func (j *SignerSigningJob) Remove(_ context.Context) error { // Signing jobs are viewable by the ListSigningJobs operation for two years after they are performed [1] // As a precaution we are updating Signing jobs statuses to revoked. This indicates that the signature is no longer valid. // [1] https://awscli.amazonaws.com/v2/documentation/api/latest/reference/signer/start-signing-job.html diff --git a/resources/simpledb-domains.go b/resources/simpledb-domains.go index 2c0520b0f..46ec07b6b 100644 --- a/resources/simpledb-domains.go +++ b/resources/simpledb-domains.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/simpledb" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SimpleDBDomain struct { - svc *simpledb.SimpleDB - domainName *string -} +const SimpleDBDomainResource = "SimpleDBDomain" func init() { - register("SimpleDBDomain", ListSimpleDBDomains) + resource.Register(resource.Registration{ + Name: SimpleDBDomainResource, + Scope: nuke.Account, + Lister: &SimpleDBDomainLister{}, + }) } -func ListSimpleDBDomains(sess *session.Session) ([]Resource, error) { - svc := simpledb.New(sess) - resources := []Resource{} +type SimpleDBDomainLister struct{} + +func (l *SimpleDBDomainLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := simpledb.New(opts.Session) + resources := make([]resource.Resource, 0) params := &simpledb.ListDomainsInput{ MaxNumberOfDomains: aws.Int64(100), @@ -46,8 +56,12 @@ func ListSimpleDBDomains(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SimpleDBDomain) Remove() error { +type SimpleDBDomain struct { + svc *simpledb.SimpleDB + domainName *string +} +func (f *SimpleDBDomain) Remove(_ context.Context) error { _, err := f.svc.DeleteDomain(&simpledb.DeleteDomainInput{ DomainName: f.domainName, }) diff --git a/resources/sns-endpoints.go b/resources/sns-endpoints.go index 297f0573a..56d3dba4d 100644 --- a/resources/sns-endpoints.go +++ b/resources/sns-endpoints.go @@ -1,31 +1,43 @@ package resources import ( + "context" + + "errors" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sns" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SNSEndpoint struct { - svc *sns.SNS - ARN *string -} +const SNSEndpointResource = "SNSEndpoint" func init() { - register("SNSEndpoint", ListSNSEndpoints) + resource.Register(resource.Registration{ + Name: SNSEndpointResource, + Scope: nuke.Account, + Lister: &SNSEndpointLister{}, + }) } -func ListSNSEndpoints(sess *session.Session) ([]Resource, error) { - svc := sns.New(sess) - resources := []Resource{} - platformApplications := []*sns.PlatformApplication{} +type SNSEndpointLister struct{} + +func (l *SNSEndpointLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sns.New(opts.Session) + resources := make([]resource.Resource, 0) + var platformApplications []*sns.PlatformApplication platformParams := &sns.ListPlatformApplicationsInput{} for { resp, err := svc.ListPlatformApplications(platformParams) if err != nil { - awsErr, ok := err.(awserr.Error) + var awsErr awserr.Error + ok := errors.As(err, &awsErr) if ok && awsErr.Code() == "InvalidAction" && awsErr.Message() == "Operation (ListPlatformApplications) is not supported in this region" { // AWS answers with InvalidAction on regions that do not // support ListPlatformApplications. @@ -72,8 +84,12 @@ func ListSNSEndpoints(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SNSEndpoint) Remove() error { +type SNSEndpoint struct { + svc *sns.SNS + ARN *string +} +func (f *SNSEndpoint) Remove(_ context.Context) error { _, err := f.svc.DeleteEndpoint(&sns.DeleteEndpointInput{ EndpointArn: f.ARN, }) diff --git a/resources/sns-platformapplications.go b/resources/sns-platformapplications.go index b48069876..49553f752 100644 --- a/resources/sns-platformapplications.go +++ b/resources/sns-platformapplications.go @@ -1,30 +1,42 @@ package resources import ( + "context" + + "errors" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sns" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SNSPlatformApplication struct { - svc *sns.SNS - ARN *string -} +const SNSPlatformApplicationResource = "SNSPlatformApplication" func init() { - register("SNSPlatformApplication", ListSNSPlatformApplications) + resource.Register(resource.Registration{ + Name: SNSPlatformApplicationResource, + Scope: nuke.Account, + Lister: &SNSPlatformApplicationLister{}, + }) } -func ListSNSPlatformApplications(sess *session.Session) ([]Resource, error) { - svc := sns.New(sess) - resources := []Resource{} +type SNSPlatformApplicationLister struct{} + +func (l *SNSPlatformApplicationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sns.New(opts.Session) + resources := make([]resource.Resource, 0) params := &sns.ListPlatformApplicationsInput{} for { resp, err := svc.ListPlatformApplications(params) if err != nil { - awsErr, ok := err.(awserr.Error) + var awsErr awserr.Error + ok := errors.As(err, &awsErr) if ok && awsErr.Code() == "InvalidAction" && awsErr.Message() == "Operation (ListPlatformApplications) is not supported in this region" { // AWS answers with InvalidAction on regions that do not // support ListPlatformApplications. @@ -49,8 +61,12 @@ func ListSNSPlatformApplications(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SNSPlatformApplication) Remove() error { +type SNSPlatformApplication struct { + svc *sns.SNS + ARN *string +} +func (f *SNSPlatformApplication) Remove(_ context.Context) error { _, err := f.svc.DeletePlatformApplication(&sns.DeletePlatformApplicationInput{ PlatformApplicationArn: f.ARN, }) diff --git a/resources/sns-subscriptions.go b/resources/sns-subscriptions.go index 30f07a016..b227c85a0 100644 --- a/resources/sns-subscriptions.go +++ b/resources/sns-subscriptions.go @@ -1,21 +1,36 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sns" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) +const SNSSubscriptionResource = "SNSSubscription" + func init() { - register("SNSSubscription", ListSNSSubscriptions) + resource.Register(resource.Registration{ + Name: SNSSubscriptionResource, + Scope: nuke.Account, + Lister: &SNSSubscriptionLister{}, + }) } -func ListSNSSubscriptions(sess *session.Session) ([]Resource, error) { - svc := sns.New(sess) +type SNSSubscriptionLister struct{} + +func (l *SNSSubscriptionLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sns.New(opts.Session) params := &sns.ListSubscriptionsInput{} - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for { resp, err := svc.ListSubscriptions(params) @@ -49,7 +64,7 @@ type SNSSubscription struct { name *string } -func (subs *SNSSubscription) Remove() error { +func (subs *SNSSubscription) Remove(_ context.Context) error { _, err := subs.svc.Unsubscribe(&sns.UnsubscribeInput{ SubscriptionArn: subs.id, }) diff --git a/resources/sns-topics.go b/resources/sns-topics.go index 22010bd2a..289d6fa45 100644 --- a/resources/sns-topics.go +++ b/resources/sns-topics.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "fmt" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sns" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SNSTopic struct { - svc *sns.SNS - id *string - tags []*sns.Tag -} +const SNSTopicResource = "SNSTopic" func init() { - register("SNSTopic", ListSNSTopics) + resource.Register(resource.Registration{ + Name: SNSTopicResource, + Scope: nuke.Account, + Lister: &SNSTopicLister{}, + }) } -func ListSNSTopics(sess *session.Session) ([]Resource, error) { - svc := sns.New(sess) +type SNSTopicLister struct{} + +func (l *SNSTopicLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sns.New(opts.Session) topics := make([]*sns.Topic, 0) @@ -34,7 +43,7 @@ func ListSNSTopics(sess *session.Session) ([]Resource, error) { if err != nil { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, topic := range topics { tags, err := svc.ListTagsForResource(&sns.ListTagsForResourceInput{ ResourceArn: topic.TopicArn, @@ -53,7 +62,13 @@ func ListSNSTopics(sess *session.Session) ([]Resource, error) { return resources, nil } -func (topic *SNSTopic) Remove() error { +type SNSTopic struct { + svc *sns.SNS + id *string + tags []*sns.Tag +} + +func (topic *SNSTopic) Remove(_ context.Context) error { _, err := topic.svc.DeleteTopic(&sns.DeleteTopicInput{ TopicArn: topic.id, }) diff --git a/resources/sqs-queues.go b/resources/sqs-queues.go index 1821834f8..1be01fcb3 100644 --- a/resources/sqs-queues.go +++ b/resources/sqs-queues.go @@ -1,21 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + + "github.com/gotidy/ptr" + "github.com/aws/aws-sdk-go/service/sqs" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SQSQueue struct { - svc *sqs.SQS - queueURL *string -} +const SQSQueueResource = "SQSQueue" func init() { - register("SQSQueue", ListSQSQueues) + resource.Register(resource.Registration{ + Name: SQSQueueResource, + Scope: nuke.Account, + Lister: &SQSQueueLister{}, + }) } -func ListSQSQueues(sess *session.Session) ([]Resource, error) { - svc := sqs.New(sess) +type SQSQueueLister struct{} + +func (l *SQSQueueLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := sqs.New(opts.Session) params := &sqs.ListQueuesInput{} resp, err := svc.ListQueues(params) @@ -23,7 +35,7 @@ func ListSQSQueues(sess *session.Session) ([]Resource, error) { return nil, err } - resources := make([]Resource, 0) + resources := make([]resource.Resource, 0) for _, queue := range resp.QueueUrls { resources = append(resources, &SQSQueue{ svc: svc, @@ -34,8 +46,12 @@ func ListSQSQueues(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SQSQueue) Remove() error { +type SQSQueue struct { + svc *sqs.SQS + queueURL *string +} +func (f *SQSQueue) Remove(_ context.Context) error { _, err := f.svc.DeleteQueue(&sqs.DeleteQueueInput{ QueueUrl: f.queueURL, }) @@ -44,5 +60,5 @@ func (f *SQSQueue) Remove() error { } func (f *SQSQueue) String() string { - return *f.queueURL + return ptr.ToString(f.queueURL) } diff --git a/resources/ssm-activations.go b/resources/ssm-activations.go index 9486b75fd..eef7f5d04 100644 --- a/resources/ssm-activations.go +++ b/resources/ssm-activations.go @@ -1,23 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/ssm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SSMActivation struct { - svc *ssm.SSM - ID *string -} +const SSMActivationResource = "SSMActivation" func init() { - register("SSMActivation", ListSSMActivations) + resource.Register(resource.Registration{ + Name: SSMActivationResource, + Scope: nuke.Account, + Lister: &SSMActivationLister{}, + }) } -func ListSSMActivations(sess *session.Session) ([]Resource, error) { - svc := ssm.New(sess) - resources := []Resource{} +type SSMActivationLister struct{} + +func (l *SSMActivationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ssm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ssm.DescribeActivationsInput{ MaxResults: aws.Int64(50), @@ -46,8 +57,12 @@ func ListSSMActivations(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SSMActivation) Remove() error { +type SSMActivation struct { + svc *ssm.SSM + ID *string +} +func (f *SSMActivation) Remove(_ context.Context) error { _, err := f.svc.DeleteActivation(&ssm.DeleteActivationInput{ ActivationId: f.ID, }) diff --git a/resources/ssm-associations.go b/resources/ssm-associations.go index fb0e13830..82088748c 100644 --- a/resources/ssm-associations.go +++ b/resources/ssm-associations.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ssm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SSMAssociation struct { - svc *ssm.SSM - associationID *string - instanceID *string -} +const SSMAssociationResource = "SSMAssociation" func init() { - register("SSMAssociation", ListSSMAssociations) + resource.Register(resource.Registration{ + Name: SSMAssociationResource, + Scope: nuke.Account, + Lister: &SSMAssociationLister{}, + }) } -func ListSSMAssociations(sess *session.Session) ([]Resource, error) { - svc := ssm.New(sess) - resources := []Resource{} +type SSMAssociationLister struct{} + +func (l *SSMAssociationLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ssm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ssm.ListAssociationsInput{ MaxResults: aws.Int64(50), @@ -48,8 +57,13 @@ func ListSSMAssociations(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SSMAssociation) Remove() error { +type SSMAssociation struct { + svc *ssm.SSM + associationID *string + instanceID *string +} +func (f *SSMAssociation) Remove(_ context.Context) error { _, err := f.svc.DeleteAssociation(&ssm.DeleteAssociationInput{ AssociationId: f.associationID, }) diff --git a/resources/ssm-documents.go b/resources/ssm-documents.go index d7e5f01a1..459d859fd 100644 --- a/resources/ssm-documents.go +++ b/resources/ssm-documents.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ssm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SSMDocument struct { - svc *ssm.SSM - name *string -} +const SSMDocumentResource = "SSMDocument" func init() { - register("SSMDocument", ListSSMDocuments) + resource.Register(resource.Registration{ + Name: SSMDocumentResource, + Scope: nuke.Account, + Lister: &SSMDocumentLister{}, + }) } -func ListSSMDocuments(sess *session.Session) ([]Resource, error) { - svc := ssm.New(sess) - resources := []Resource{} +type SSMDocumentLister struct{} + +func (l *SSMDocumentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ssm.New(opts.Session) + resources := make([]resource.Resource, 0) documentKeyFilter := []*ssm.DocumentKeyValuesFilter{ { @@ -54,8 +64,12 @@ func ListSSMDocuments(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SSMDocument) Remove() error { +type SSMDocument struct { + svc *ssm.SSM + name *string +} +func (f *SSMDocument) Remove(_ context.Context) error { _, err := f.svc.DeleteDocument(&ssm.DeleteDocumentInput{ Name: f.name, }) diff --git a/resources/ssm-maintenancewindows.go b/resources/ssm-maintenancewindows.go index 98c92d825..7afaab0e7 100644 --- a/resources/ssm-maintenancewindows.go +++ b/resources/ssm-maintenancewindows.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ssm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SSMMaintenanceWindow struct { - svc *ssm.SSM - ID *string -} +const SSMMaintenanceWindowResource = "SSMMaintenanceWindow" func init() { - register("SSMMaintenanceWindow", ListSSMMaintenanceWindows) + resource.Register(resource.Registration{ + Name: SSMMaintenanceWindowResource, + Scope: nuke.Account, + Lister: &SSMMaintenanceWindowLister{}, + }) } -func ListSSMMaintenanceWindows(sess *session.Session) ([]Resource, error) { - svc := ssm.New(sess) - resources := []Resource{} +type SSMMaintenanceWindowLister struct{} + +func (l *SSMMaintenanceWindowLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ssm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ssm.DescribeMaintenanceWindowsInput{ MaxResults: aws.Int64(50), @@ -46,8 +56,12 @@ func ListSSMMaintenanceWindows(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SSMMaintenanceWindow) Remove() error { +type SSMMaintenanceWindow struct { + svc *ssm.SSM + ID *string +} +func (f *SSMMaintenanceWindow) Remove(_ context.Context) error { _, err := f.svc.DeleteMaintenanceWindow(&ssm.DeleteMaintenanceWindowInput{ WindowId: f.ID, }) diff --git a/resources/ssm-parameters.go b/resources/ssm-parameters.go index 15bf60f71..50ff455ea 100644 --- a/resources/ssm-parameters.go +++ b/resources/ssm-parameters.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ssm" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SSMParameter struct { - svc *ssm.SSM - name *string - tags []*ssm.Tag -} +const SSMParameterResource = "SSMParameter" func init() { - register("SSMParameter", ListSSMParameters) + resource.Register(resource.Registration{ + Name: SSMParameterResource, + Scope: nuke.Account, + Lister: &SSMParameterLister{}, + }) } -func ListSSMParameters(sess *session.Session) ([]Resource, error) { - svc := ssm.New(sess) - resources := []Resource{} +type SSMParameterLister struct{} + +func (l *SSMParameterLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ssm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ssm.DescribeParametersInput{ MaxResults: aws.Int64(50), @@ -59,8 +68,13 @@ func ListSSMParameters(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SSMParameter) Remove() error { +type SSMParameter struct { + svc *ssm.SSM + name *string + tags []*ssm.Tag +} +func (f *SSMParameter) Remove(_ context.Context) error { _, err := f.svc.DeleteParameter(&ssm.DeleteParameterInput{ Name: f.name, }) diff --git a/resources/ssm-patchbaselines.go b/resources/ssm-patchbaselines.go index fbb3ee442..92dfa6bf7 100644 --- a/resources/ssm-patchbaselines.go +++ b/resources/ssm-patchbaselines.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ssm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SSMPatchBaseline struct { - svc *ssm.SSM - ID *string - defaultBaseline *bool -} +const SSMPatchBaselineResource = "SSMPatchBaseline" func init() { - register("SSMPatchBaseline", ListSSMPatchBaselines) + resource.Register(resource.Registration{ + Name: SSMPatchBaselineResource, + Scope: nuke.Account, + Lister: &SSMPatchBaselineLister{}, + }) } -func ListSSMPatchBaselines(sess *session.Session) ([]Resource, error) { - svc := ssm.New(sess) - resources := []Resource{} +type SSMPatchBaselineLister struct{} + +func (l *SSMPatchBaselineLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ssm.New(opts.Session) + resources := make([]resource.Resource, 0) patchBaselineFilter := []*ssm.PatchOrchestratorFilter{ { @@ -58,7 +67,13 @@ func ListSSMPatchBaselines(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SSMPatchBaseline) Remove() error { +type SSMPatchBaseline struct { + svc *ssm.SSM + ID *string + defaultBaseline *bool +} + +func (f *SSMPatchBaseline) Remove(_ context.Context) error { err := f.DeregisterFromPatchGroups() if err != nil { return err diff --git a/resources/ssm-resourcedatasyncs.go b/resources/ssm-resourcedatasyncs.go index e2f6c0b5f..99fe5e131 100644 --- a/resources/ssm-resourcedatasyncs.go +++ b/resources/ssm-resourcedatasyncs.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ssm" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type SSMResourceDataSync struct { - svc *ssm.SSM - name *string -} +const SSMResourceDataSyncResource = "SSMResourceDataSync" func init() { - register("SSMResourceDataSync", ListSSMResourceDataSyncs) + resource.Register(resource.Registration{ + Name: SSMResourceDataSyncResource, + Scope: nuke.Account, + Lister: &SSMResourceDataSyncLister{}, + }) } -func ListSSMResourceDataSyncs(sess *session.Session) ([]Resource, error) { - svc := ssm.New(sess) - resources := []Resource{} +type SSMResourceDataSyncLister struct{} + +func (l *SSMResourceDataSyncLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := ssm.New(opts.Session) + resources := make([]resource.Resource, 0) params := &ssm.ListResourceDataSyncInput{ MaxResults: aws.Int64(50), @@ -46,8 +56,12 @@ func ListSSMResourceDataSyncs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *SSMResourceDataSync) Remove() error { +type SSMResourceDataSync struct { + svc *ssm.SSM + name *string +} +func (f *SSMResourceDataSync) Remove(_ context.Context) error { _, err := f.svc.DeleteResourceDataSync(&ssm.DeleteResourceDataSyncInput{ SyncName: f.name, }) diff --git a/resources/storagegateway-fileshares.go b/resources/storagegateway-fileshares.go index 2c550c94c..192c57aa2 100644 --- a/resources/storagegateway-fileshares.go +++ b/resources/storagegateway-fileshares.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/storagegateway" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type StorageGatewayFileShare struct { - svc *storagegateway.StorageGateway - ARN *string -} +const StorageGatewayFileShareResource = "StorageGatewayFileShare" func init() { - register("StorageGatewayFileShare", ListStorageGatewayFileShares) + resource.Register(resource.Registration{ + Name: StorageGatewayFileShareResource, + Scope: nuke.Account, + Lister: &StorageGatewayFileShareLister{}, + }) } -func ListStorageGatewayFileShares(sess *session.Session) ([]Resource, error) { - svc := storagegateway.New(sess) - resources := []Resource{} +type StorageGatewayFileShareLister struct{} + +func (l *StorageGatewayFileShareLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := storagegateway.New(opts.Session) + resources := make([]resource.Resource, 0) params := &storagegateway.ListFileSharesInput{ Limit: aws.Int64(25), @@ -46,8 +56,12 @@ func ListStorageGatewayFileShares(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *StorageGatewayFileShare) Remove() error { +type StorageGatewayFileShare struct { + svc *storagegateway.StorageGateway + ARN *string +} +func (f *StorageGatewayFileShare) Remove(_ context.Context) error { _, err := f.svc.DeleteFileShare(&storagegateway.DeleteFileShareInput{ FileShareARN: f.ARN, ForceDelete: aws.Bool(true), diff --git a/resources/storagegateway-gateways.go b/resources/storagegateway-gateways.go index d033e0b34..ce1fa83e4 100644 --- a/resources/storagegateway-gateways.go +++ b/resources/storagegateway-gateways.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/storagegateway" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type StorageGatewayGateway struct { - svc *storagegateway.StorageGateway - ARN *string -} +const StorageGatewayGatewayResource = "StorageGatewayGateway" func init() { - register("StorageGatewayGateway", ListStorageGatewayGateways) + resource.Register(resource.Registration{ + Name: StorageGatewayGatewayResource, + Scope: nuke.Account, + Lister: &StorageGatewayGatewayLister{}, + }) } -func ListStorageGatewayGateways(sess *session.Session) ([]Resource, error) { - svc := storagegateway.New(sess) - resources := []Resource{} +type StorageGatewayGatewayLister struct{} + +func (l *StorageGatewayGatewayLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := storagegateway.New(opts.Session) + resources := make([]resource.Resource, 0) params := &storagegateway.ListGatewaysInput{ Limit: aws.Int64(25), @@ -46,8 +56,12 @@ func ListStorageGatewayGateways(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *StorageGatewayGateway) Remove() error { +type StorageGatewayGateway struct { + svc *storagegateway.StorageGateway + ARN *string +} +func (f *StorageGatewayGateway) Remove(_ context.Context) error { _, err := f.svc.DeleteGateway(&storagegateway.DeleteGatewayInput{ GatewayARN: f.ARN, }) diff --git a/resources/storagegateway-tapes.go b/resources/storagegateway-tapes.go index 115f82ab1..bb83c48a7 100644 --- a/resources/storagegateway-tapes.go +++ b/resources/storagegateway-tapes.go @@ -1,24 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/storagegateway" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type StorageGatewayTape struct { - svc *storagegateway.StorageGateway - tapeARN *string - gatewayARN *string -} +const StorageGatewayTapeResource = "StorageGatewayTape" func init() { - register("StorageGatewayTape", ListStorageGatewayTapes) + resource.Register(resource.Registration{ + Name: StorageGatewayTapeResource, + Scope: nuke.Account, + Lister: &StorageGatewayTapeLister{}, + }) } -func ListStorageGatewayTapes(sess *session.Session) ([]Resource, error) { - svc := storagegateway.New(sess) - resources := []Resource{} +type StorageGatewayTapeLister struct{} + +func (l *StorageGatewayTapeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := storagegateway.New(opts.Session) + resources := make([]resource.Resource, 0) params := &storagegateway.ListTapesInput{ Limit: aws.Int64(25), @@ -48,8 +57,13 @@ func ListStorageGatewayTapes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *StorageGatewayTape) Remove() error { +type StorageGatewayTape struct { + svc *storagegateway.StorageGateway + tapeARN *string + gatewayARN *string +} +func (f *StorageGatewayTape) Remove(_ context.Context) error { _, err := f.svc.DeleteTape(&storagegateway.DeleteTapeInput{ TapeARN: f.tapeARN, GatewayARN: f.gatewayARN, diff --git a/resources/storagegateway-volumes.go b/resources/storagegateway-volumes.go index eea7d9724..4942851fd 100644 --- a/resources/storagegateway-volumes.go +++ b/resources/storagegateway-volumes.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/storagegateway" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type StorageGatewayVolume struct { - svc *storagegateway.StorageGateway - ARN *string -} +const StorageGatewayVolumeResource = "StorageGatewayVolume" func init() { - register("StorageGatewayVolume", ListStorageGatewayVolumes) + resource.Register(resource.Registration{ + Name: StorageGatewayVolumeResource, + Scope: nuke.Account, + Lister: &StorageGatewayVolumeLister{}, + }) } -func ListStorageGatewayVolumes(sess *session.Session) ([]Resource, error) { - svc := storagegateway.New(sess) - resources := []Resource{} +type StorageGatewayVolumeLister struct{} + +func (l *StorageGatewayVolumeLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := storagegateway.New(opts.Session) + resources := make([]resource.Resource, 0) params := &storagegateway.ListVolumesInput{ Limit: aws.Int64(25), @@ -46,7 +56,12 @@ func ListStorageGatewayVolumes(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *StorageGatewayVolume) Remove() error { +type StorageGatewayVolume struct { + svc *storagegateway.StorageGateway + ARN *string +} + +func (f *StorageGatewayVolume) Remove(_ context.Context) error { _, err := f.svc.DeleteVolume(&storagegateway.DeleteVolumeInput{ VolumeARN: f.ARN, diff --git a/resources/transfer-server-user.go b/resources/transfer-server-user.go index 438ce4418..4c9640e81 100644 --- a/resources/transfer-server-user.go +++ b/resources/transfer-server-user.go @@ -1,28 +1,36 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/transfer" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type TransferServerUser struct { - svc *transfer.Transfer - username *string - serverID *string - tags []*transfer.Tag -} +const TransferServerUserResource = "TransferServerUser" func init() { - register("TransferServerUser", ListTransferServerUsers) + resource.Register(resource.Registration{ + Name: TransferServerUserResource, + Scope: nuke.Account, + Lister: &TransferServerUserLister{}, + }) } -func ListTransferServerUsers(sess *session.Session) ([]Resource, error) { - svc := transfer.New(sess) - resources := []Resource{} +type TransferServerUserLister struct{} + +func (l *TransferServerUserLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := transfer.New(opts.Session) + resources := make([]resource.Resource, 0) params := &transfer.ListServersInput{ MaxResults: aws.Int64(50), @@ -82,8 +90,14 @@ func ListTransferServerUsers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (ts *TransferServerUser) Remove() error { +type TransferServerUser struct { + svc *transfer.Transfer + username *string + serverID *string + tags []*transfer.Tag +} +func (ts *TransferServerUser) Remove(_ context.Context) error { _, err := ts.svc.DeleteUser(&transfer.DeleteUserInput{ ServerId: ts.serverID, UserName: ts.username, diff --git a/resources/transfer-server.go b/resources/transfer-server.go index afa26e83d..c8a258bc7 100644 --- a/resources/transfer-server.go +++ b/resources/transfer-server.go @@ -1,29 +1,36 @@ package resources import ( + "context" + "strings" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/transfer" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type TransferServer struct { - svc *transfer.Transfer - serverID *string - endpointType *string - protocols []string - tags []*transfer.Tag -} +const TransferServerResource = "TransferServer" func init() { - register("TransferServer", ListTransferServers) + resource.Register(resource.Registration{ + Name: TransferServerResource, + Scope: nuke.Account, + Lister: &TransferServerLister{}, + }) } -func ListTransferServers(sess *session.Session) ([]Resource, error) { - svc := transfer.New(sess) - resources := []Resource{} +type TransferServerLister struct{} + +func (l *TransferServerLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := transfer.New(opts.Session) + resources := make([]resource.Resource, 0) params := &transfer.ListServersInput{ MaxResults: aws.Int64(50), @@ -43,7 +50,7 @@ func ListTransferServers(sess *session.Session) ([]Resource, error) { return nil, err } - protocols := []string{} + var protocols []string for _, protocol := range descOutput.Server.Protocols { protocols = append(protocols, *protocol) } @@ -67,8 +74,15 @@ func ListTransferServers(sess *session.Session) ([]Resource, error) { return resources, nil } -func (ts *TransferServer) Remove() error { +type TransferServer struct { + svc *transfer.Transfer + serverID *string + endpointType *string + protocols []string + tags []*transfer.Tag +} +func (ts *TransferServer) Remove(_ context.Context) error { _, err := ts.svc.DeleteServer(&transfer.DeleteServerInput{ ServerId: ts.serverID, }) diff --git a/resources/util.go b/resources/util.go deleted file mode 100644 index 22a3e1b2e..000000000 --- a/resources/util.go +++ /dev/null @@ -1,38 +0,0 @@ -package resources - -import "github.com/aws/aws-sdk-go/aws/awserr" - -func UnPtrBool(ptr *bool, def bool) bool { - if ptr == nil { - return def - } - return *ptr -} - -func UnPtrString(ptr *string, def string) string { - if ptr == nil { - return def - } - return *ptr -} - -func EqualStringPtr(v1, v2 *string) bool { - if v1 == nil && v2 == nil { - return true - } - - if v1 == nil || v2 == nil { - return false - } - - return *v1 == *v2 -} - -func IsAWSError(err error, code string) bool { - aerr, ok := err.(awserr.Error) - if !ok { - return false - } - - return aerr.Code() == code -} diff --git a/resources/waf-rules.go b/resources/waf-rules.go index a4b2b4297..cc46e52ed 100644 --- a/resources/waf-rules.go +++ b/resources/waf-rules.go @@ -1,25 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRule struct { - svc *waf.WAF - ID *string - rule *waf.Rule -} +const WAFRuleResource = "WAFRule" func init() { - register("WAFRule", ListWAFRules) + resource.Register(resource.Registration{ + Name: WAFRuleResource, + Scope: nuke.Account, + Lister: &WAFRuleLister{}, + }) } -func ListWAFRules(sess *session.Session) ([]Resource, error) { - svc := waf.New(sess) - resources := []Resource{} +type WAFRuleLister struct{} + +func (l *WAFRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := waf.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRulesInput{ Limit: aws.Int64(50), @@ -52,14 +61,19 @@ func ListWAFRules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WAFRule) Remove() error { +type WAFRule struct { + svc *waf.WAF + ID *string + rule *waf.Rule +} +func (f *WAFRule) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err } - ruleUpdates := []*waf.RuleUpdate{} + var ruleUpdates []*waf.RuleUpdate for _, predicate := range f.rule.Predicates { ruleUpdates = append(ruleUpdates, &waf.RuleUpdate{ Action: aws.String(waf.ChangeActionDelete), diff --git a/resources/waf-webacl-rule-attachements.go b/resources/waf-webacl-rule-attachments.go similarity index 62% rename from resources/waf-webacl-rule-attachements.go rename to resources/waf-webacl-rule-attachments.go index 6d08e0d7b..dd52e55f7 100644 --- a/resources/waf-webacl-rule-attachements.go +++ b/resources/waf-webacl-rule-attachments.go @@ -1,33 +1,42 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFWebACLRuleAttachment struct { - svc *waf.WAF - webACLID *string - activatedRule *waf.ActivatedRule -} +const WAFWebACLRuleAttachmentResource = "WAFWebACLRuleAttachment" func init() { - register("WAFWebACLRuleAttachment", ListWAFWebACLRuleAttachments) + resource.Register(resource.Registration{ + Name: WAFWebACLRuleAttachmentResource, + Scope: nuke.Account, + Lister: &WAFWebACLRuleAttachmentLister{}, + }) } -func ListWAFWebACLRuleAttachments(sess *session.Session) ([]Resource, error) { - svc := waf.New(sess) - resources := []Resource{} - webACLs := []*waf.WebACLSummary{} +type WAFWebACLRuleAttachmentLister struct{} + +func (l *WAFWebACLRuleAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := waf.New(opts.Session) + resources := make([]resource.Resource, 0) + var webACLs []*waf.WebACLSummary params := &waf.ListWebACLsInput{ Limit: aws.Int64(50), } - //List All Web ACL's + //List All Web ACLs for { resp, err := svc.ListWebACLs(params) if err != nil { @@ -58,7 +67,7 @@ func ListWAFWebACLRuleAttachments(sess *session.Session) ([]Resource, error) { for _, webACLRule := range resp.WebACL.Rules { resources = append(resources, &WAFWebACLRuleAttachment{ svc: svc, - webACLID: webACL.WebACLId, + webAclID: webACL.WebACLId, activatedRule: webACLRule, }) } @@ -68,7 +77,13 @@ func ListWAFWebACLRuleAttachments(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WAFWebACLRuleAttachment) Remove() error { +type WAFWebACLRuleAttachment struct { + svc *waf.WAF + webAclID *string + activatedRule *waf.ActivatedRule +} + +func (f *WAFWebACLRuleAttachment) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { @@ -81,7 +96,7 @@ func (f *WAFWebACLRuleAttachment) Remove() error { } _, err = f.svc.UpdateWebACL(&waf.UpdateWebACLInput{ - WebACLId: f.webACLID, + WebACLId: f.webAclID, ChangeToken: tokenOutput.ChangeToken, Updates: []*waf.WebACLUpdate{webACLUpdate}, }) @@ -90,5 +105,5 @@ func (f *WAFWebACLRuleAttachment) Remove() error { } func (f *WAFWebACLRuleAttachment) String() string { - return fmt.Sprintf("%s -> %s", *f.webACLID, *f.activatedRule.RuleId) + return fmt.Sprintf("%s -> %s", *f.webAclID, *f.activatedRule.RuleId) } diff --git a/resources/waf-webacls.go b/resources/waf-webacls.go index 29fb817ad..c40cf189b 100644 --- a/resources/waf-webacls.go +++ b/resources/waf-webacls.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFWebACL struct { - svc *waf.WAF - ID *string -} +const WAFWebACLResource = "WAFWebACL" func init() { - register("WAFWebACL", ListWAFWebACLs) + resource.Register(resource.Registration{ + Name: WAFWebACLResource, + Scope: nuke.Account, + Lister: &WAFWebACLLister{}, + }) } -func ListWAFWebACLs(sess *session.Session) ([]Resource, error) { - svc := waf.New(sess) - resources := []Resource{} +type WAFWebACLLister struct{} + +func (l *WAFWebACLLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := waf.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListWebACLsInput{ Limit: aws.Int64(50), @@ -46,8 +56,12 @@ func ListWAFWebACLs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WAFWebACL) Remove() error { +type WAFWebACL struct { + svc *waf.WAF + ID *string +} +func (f *WAFWebACL) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-byte-match-set-tuples.go b/resources/wafregional-byte-match-set-tuples.go index ddf7966f7..7cf6b0a56 100644 --- a/resources/wafregional-byte-match-set-tuples.go +++ b/resources/wafregional-byte-match-set-tuples.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalByteMatchSetIP struct { - svc *wafregional.WAFRegional - matchSetid *string - tuple *waf.ByteMatchTuple -} +const WAFRegionalByteMatchSetIPResource = "WAFRegionalByteMatchSetIP" func init() { - register("WAFRegionalByteMatchSetIP", ListWAFRegionalByteMatchSetIPs) + resource.Register(resource.Registration{ + Name: WAFRegionalByteMatchSetIPResource, + Scope: nuke.Account, + Lister: &WAFRegionalByteMatchSetIPLister{}, + }) } -func ListWAFRegionalByteMatchSetIPs(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalByteMatchSetIPLister struct{} + +func (l *WAFRegionalByteMatchSetIPLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListByteMatchSetsInput{ Limit: aws.Int64(50), @@ -44,7 +53,7 @@ func ListWAFRegionalByteMatchSetIPs(sess *session.Session) ([]Resource, error) { for _, tuple := range details.ByteMatchSet.ByteMatchTuples { resources = append(resources, &WAFRegionalByteMatchSetIP{ svc: svc, - matchSetid: set.ByteMatchSetId, + matchSetID: set.ByteMatchSetId, tuple: tuple, }) } @@ -60,7 +69,13 @@ func ListWAFRegionalByteMatchSetIPs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalByteMatchSetIP) Remove() error { +type WAFRegionalByteMatchSetIP struct { + svc *wafregional.WAFRegional + matchSetID *string + tuple *waf.ByteMatchTuple +} + +func (r *WAFRegionalByteMatchSetIP) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err @@ -68,7 +83,7 @@ func (r *WAFRegionalByteMatchSetIP) Remove() error { _, err = r.svc.UpdateByteMatchSet(&waf.UpdateByteMatchSetInput{ ChangeToken: tokenOutput.ChangeToken, - ByteMatchSetId: r.matchSetid, + ByteMatchSetId: r.matchSetID, Updates: []*waf.ByteMatchSetUpdate{ &waf.ByteMatchSetUpdate{ Action: aws.String("DELETE"), @@ -82,7 +97,7 @@ func (r *WAFRegionalByteMatchSetIP) Remove() error { func (r *WAFRegionalByteMatchSetIP) Properties() types.Properties { return types.NewProperties(). - Set("ByteMatchSetID", r.matchSetid). + Set("ByteMatchSetID", r.matchSetID). Set("FieldToMatchType", r.tuple.FieldToMatch.Type). Set("FieldToMatchData", r.tuple.FieldToMatch.Data). Set("TargetString", r.tuple.TargetString) diff --git a/resources/wafregional-byte-match-sets.go b/resources/wafregional-byte-match-sets.go index d9d1e1676..922dfe6ca 100644 --- a/resources/wafregional-byte-match-sets.go +++ b/resources/wafregional-byte-match-sets.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalByteMatchSet struct { - svc *wafregional.WAFRegional - id *string - name *string -} +const WAFRegionalByteMatchSetResource = "WAFRegionalByteMatchSet" func init() { - register("WAFRegionalByteMatchSet", ListWAFRegionalByteMatchSets) + resource.Register(resource.Registration{ + Name: WAFRegionalByteMatchSetResource, + Scope: nuke.Account, + Lister: &WAFRegionalByteMatchSetLister{}, + }) } -func ListWAFRegionalByteMatchSets(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalByteMatchSetLister struct{} + +func (l *WAFRegionalByteMatchSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListByteMatchSetsInput{ Limit: aws.Int64(50), @@ -50,7 +59,13 @@ func ListWAFRegionalByteMatchSets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalByteMatchSet) Remove() error { +type WAFRegionalByteMatchSet struct { + svc *wafregional.WAFRegional + id *string + name *string +} + +func (r *WAFRegionalByteMatchSet) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-ip-set-ips.go b/resources/wafregional-ip-set-ips.go index 6ad754cc2..89e7b89f2 100644 --- a/resources/wafregional-ip-set-ips.go +++ b/resources/wafregional-ip-set-ips.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalIPSetIP struct { - svc *wafregional.WAFRegional - ipSetid *string - descriptor *waf.IPSetDescriptor -} +const WAFRegionalIPSetIPResource = "WAFRegionalIPSetIP" func init() { - register("WAFRegionalIPSetIP", ListWAFRegionalIPSetIPs) + resource.Register(resource.Registration{ + Name: WAFRegionalIPSetIPResource, + Scope: nuke.Account, + Lister: &WAFRegionalIPSetIPLister{}, + }) } -func ListWAFRegionalIPSetIPs(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalIPSetIPLister struct{} + +func (l *WAFRegionalIPSetIPLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListIPSetsInput{ Limit: aws.Int64(50), @@ -44,7 +53,7 @@ func ListWAFRegionalIPSetIPs(sess *session.Session) ([]Resource, error) { for _, descriptor := range details.IPSet.IPSetDescriptors { resources = append(resources, &WAFRegionalIPSetIP{ svc: svc, - ipSetid: set.IPSetId, + ipSetID: set.IPSetId, descriptor: descriptor, }) } @@ -60,7 +69,13 @@ func ListWAFRegionalIPSetIPs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalIPSetIP) Remove() error { +type WAFRegionalIPSetIP struct { + svc *wafregional.WAFRegional + ipSetID *string + descriptor *waf.IPSetDescriptor +} + +func (r *WAFRegionalIPSetIP) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err @@ -68,7 +83,7 @@ func (r *WAFRegionalIPSetIP) Remove() error { _, err = r.svc.UpdateIPSet(&waf.UpdateIPSetInput{ ChangeToken: tokenOutput.ChangeToken, - IPSetId: r.ipSetid, + IPSetId: r.ipSetID, Updates: []*waf.IPSetUpdate{ &waf.IPSetUpdate{ Action: aws.String("DELETE"), @@ -82,7 +97,7 @@ func (r *WAFRegionalIPSetIP) Remove() error { func (r *WAFRegionalIPSetIP) Properties() types.Properties { return types.NewProperties(). - Set("IPSetID", r.ipSetid). + Set("IPSetID", r.ipSetID). Set("Type", r.descriptor.Type). Set("Value", r.descriptor.Value) } diff --git a/resources/wafregional-ip-sets.go b/resources/wafregional-ip-sets.go index e9e3c31aa..876a267df 100644 --- a/resources/wafregional-ip-sets.go +++ b/resources/wafregional-ip-sets.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalIPSet struct { - svc *wafregional.WAFRegional - id *string - name *string -} +const WAFRegionalIPSetResource = "WAFRegionalIPSet" func init() { - register("WAFRegionalIPSet", ListWAFRegionalIPSets) + resource.Register(resource.Registration{ + Name: WAFRegionalIPSetResource, + Scope: nuke.Account, + Lister: &WAFRegionalIPSetLister{}, + }) } -func ListWAFRegionalIPSets(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalIPSetLister struct{} + +func (l *WAFRegionalIPSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListIPSetsInput{ Limit: aws.Int64(50), @@ -50,7 +59,13 @@ func ListWAFRegionalIPSets(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalIPSet) Remove() error { +type WAFRegionalIPSet struct { + svc *wafregional.WAFRegional + id *string + name *string +} + +func (r *WAFRegionalIPSet) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-rate-based-rule-predicates.go b/resources/wafregional-rate-based-rule-predicates.go index 67319a56d..7e35f3d0d 100644 --- a/resources/wafregional-rate-based-rule-predicates.go +++ b/resources/wafregional-rate-based-rule-predicates.go @@ -1,27 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRateBasedRulePredicate struct { - svc *wafregional.WAFRegional - ruleID *string - predicate *waf.Predicate - rateLimit *int64 -} +const WAFRegionalRateBasedRulePredicateResource = "WAFRegionalRateBasedRulePredicate" func init() { - register("WAFRegionalRateBasedRulePredicate", ListWAFRegionalRateBasedRulePredicates) + resource.Register(resource.Registration{ + Name: WAFRegionalRateBasedRulePredicateResource, + Scope: nuke.Account, + Lister: &WAFRegionalRateBasedRulePredicateLister{}, + }) } -func ListWAFRegionalRateBasedRulePredicates(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRateBasedRulePredicateLister struct{} + +func (l *WAFRegionalRateBasedRulePredicateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRateBasedRulesInput{ Limit: aws.Int64(50), @@ -61,7 +69,14 @@ func ListWAFRegionalRateBasedRulePredicates(sess *session.Session) ([]Resource, return resources, nil } -func (r *WAFRegionalRateBasedRulePredicate) Remove() error { +type WAFRegionalRateBasedRulePredicate struct { + svc *wafregional.WAFRegional + ruleID *string + predicate *waf.Predicate + rateLimit *int64 +} + +func (r *WAFRegionalRateBasedRulePredicate) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-rate-based-rules.go b/resources/wafregional-rate-based-rules.go index 367bba999..013cddb44 100644 --- a/resources/wafregional-rate-based-rules.go +++ b/resources/wafregional-rate-based-rules.go @@ -1,24 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRateBasedRule struct { - svc *wafregional.WAFRegional - ID *string -} +const WAFRegionalRateBasedRuleResource = "WAFRegionalRateBasedRule" func init() { - register("WAFRegionalRateBasedRule", ListWAFRegionalRateBasedRules) + resource.Register(resource.Registration{ + Name: WAFRegionalRateBasedRuleResource, + Scope: nuke.Account, + Lister: &WAFRegionalRateBasedRuleLister{}, + }) } -func ListWAFRegionalRateBasedRules(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRateBasedRuleLister struct{} + +func (l *WAFRegionalRateBasedRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRateBasedRulesInput{ Limit: aws.Int64(50), @@ -47,8 +57,12 @@ func ListWAFRegionalRateBasedRules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WAFRegionalRateBasedRule) Remove() error { +type WAFRegionalRateBasedRule struct { + svc *wafregional.WAFRegional + ID *string +} +func (f *WAFRegionalRateBasedRule) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-regex-match-sets.go b/resources/wafregional-regex-match-sets.go index 6e5773232..2bb82325a 100644 --- a/resources/wafregional-regex-match-sets.go +++ b/resources/wafregional-regex-match-sets.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRegexMatchSet struct { - svc *wafregional.WAFRegional - id *string - name *string -} +const WAFRegionalRegexMatchSetResource = "WAFRegionalRegexMatchSet" func init() { - register("WAFRegionalRegexMatchSet", ListWAFRegionalRegexMatchSet) + resource.Register(resource.Registration{ + Name: WAFRegionalRegexMatchSetResource, + Scope: nuke.Account, + Lister: &WAFRegionalRegexMatchSetLister{}, + }) } -func ListWAFRegionalRegexMatchSet(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRegexMatchSetLister struct{} + +func (l *WAFRegionalRegexMatchSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRegexMatchSetsInput{ Limit: aws.Int64(50), @@ -50,7 +59,13 @@ func ListWAFRegionalRegexMatchSet(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalRegexMatchSet) Remove() error { +type WAFRegionalRegexMatchSet struct { + svc *wafregional.WAFRegional + id *string + name *string +} + +func (r *WAFRegionalRegexMatchSet) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-regex-match-tuples.go b/resources/wafregional-regex-match-tuples.go index f2a9ebafa..88e6cd562 100644 --- a/resources/wafregional-regex-match-tuples.go +++ b/resources/wafregional-regex-match-tuples.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRegexMatchTuple struct { - svc *wafregional.WAFRegional - matchSetid *string - tuple *waf.RegexMatchTuple -} +const WAFRegionalRegexMatchTupleResource = "WAFRegionalRegexMatchTuple" func init() { - register("WAFRegionalRegexMatchTuple", ListWAFRegionalRegexMatchTuple) + resource.Register(resource.Registration{ + Name: WAFRegionalRegexMatchTupleResource, + Scope: nuke.Account, + Lister: &WAFRegionalRegexMatchTupleLister{}, + }) } -func ListWAFRegionalRegexMatchTuple(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRegexMatchTupleLister struct{} + +func (l *WAFRegionalRegexMatchTupleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRegexMatchSetsInput{ Limit: aws.Int64(50), @@ -43,7 +52,7 @@ func ListWAFRegionalRegexMatchTuple(sess *session.Session) ([]Resource, error) { for _, tuple := range regexMatchSet.RegexMatchSet.RegexMatchTuples { resources = append(resources, &WAFRegionalRegexMatchTuple{ svc: svc, - matchSetid: set.RegexMatchSetId, + matchSetID: set.RegexMatchSetId, tuple: tuple, }) } @@ -59,7 +68,13 @@ func ListWAFRegionalRegexMatchTuple(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalRegexMatchTuple) Remove() error { +type WAFRegionalRegexMatchTuple struct { + svc *wafregional.WAFRegional + matchSetID *string + tuple *waf.RegexMatchTuple +} + +func (r *WAFRegionalRegexMatchTuple) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err @@ -67,7 +82,7 @@ func (r *WAFRegionalRegexMatchTuple) Remove() error { _, err = r.svc.UpdateRegexMatchSet(&waf.UpdateRegexMatchSetInput{ ChangeToken: tokenOutput.ChangeToken, - RegexMatchSetId: r.matchSetid, + RegexMatchSetId: r.matchSetID, Updates: []*waf.RegexMatchSetUpdate{ &waf.RegexMatchSetUpdate{ Action: aws.String("DELETE"), @@ -81,7 +96,7 @@ func (r *WAFRegionalRegexMatchTuple) Remove() error { func (r *WAFRegionalRegexMatchTuple) Properties() types.Properties { return types.NewProperties(). - Set("RegexMatchSetID", r.matchSetid). + Set("RegexMatchSetID", r.matchSetID). Set("FieldToMatchType", r.tuple.FieldToMatch.Type). Set("FieldToMatchData", r.tuple.FieldToMatch.Data). Set("TextTransformation", r.tuple.TextTransformation) diff --git a/resources/wafregional-regex-pattern-sets.go b/resources/wafregional-regex-pattern-sets.go index f954eb133..ec0a63e37 100644 --- a/resources/wafregional-regex-pattern-sets.go +++ b/resources/wafregional-regex-pattern-sets.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRegexPatternSet struct { - svc *wafregional.WAFRegional - id *string - name *string -} +const WAFRegionalRegexPatternSetResource = "WAFRegionalRegexPatternSet" func init() { - register("WAFRegionalRegexPatternSet", ListWAFRegionalRegexPatternSet) + resource.Register(resource.Registration{ + Name: WAFRegionalRegexPatternSetResource, + Scope: nuke.Account, + Lister: &WAFRegionalRegexPatternSetLister{}, + }) } -func ListWAFRegionalRegexPatternSet(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRegexPatternSetLister struct{} + +func (l *WAFRegionalRegexPatternSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRegexPatternSetsInput{ Limit: aws.Int64(50), @@ -50,7 +59,13 @@ func ListWAFRegionalRegexPatternSet(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalRegexPatternSet) Remove() error { +type WAFRegionalRegexPatternSet struct { + svc *wafregional.WAFRegional + id *string + name *string +} + +func (r *WAFRegionalRegexPatternSet) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-regex-pattern-tuples.go b/resources/wafregional-regex-pattern-tuples.go index 9c7d8dea3..69229a513 100644 --- a/resources/wafregional-regex-pattern-tuples.go +++ b/resources/wafregional-regex-pattern-tuples.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRegexPatternString struct { - svc *wafregional.WAFRegional - patternSetid *string - patternString *string -} +const WAFRegionalRegexPatternStringResource = "WAFRegionalRegexPatternString" func init() { - register("WAFRegionalRegexPatternString", ListWAFRegionalRegexPatternString) + resource.Register(resource.Registration{ + Name: WAFRegionalRegexPatternStringResource, + Scope: nuke.Account, + Lister: &WAFRegionalRegexPatternStringLister{}, + }) } -func ListWAFRegionalRegexPatternString(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRegexPatternStringLister struct{} + +func (l *WAFRegionalRegexPatternStringLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRegexPatternSetsInput{ Limit: aws.Int64(50), @@ -43,7 +52,7 @@ func ListWAFRegionalRegexPatternString(sess *session.Session) ([]Resource, error for _, patternString := range regexPatternSet.RegexPatternSet.RegexPatternStrings { resources = append(resources, &WAFRegionalRegexPatternString{ svc: svc, - patternSetid: set.RegexPatternSetId, + patternSetID: set.RegexPatternSetId, patternString: patternString, }) } @@ -59,7 +68,13 @@ func ListWAFRegionalRegexPatternString(sess *session.Session) ([]Resource, error return resources, nil } -func (r *WAFRegionalRegexPatternString) Remove() error { +type WAFRegionalRegexPatternString struct { + svc *wafregional.WAFRegional + patternSetID *string + patternString *string +} + +func (r *WAFRegionalRegexPatternString) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err @@ -67,7 +82,7 @@ func (r *WAFRegionalRegexPatternString) Remove() error { _, err = r.svc.UpdateRegexPatternSet(&waf.UpdateRegexPatternSetInput{ ChangeToken: tokenOutput.ChangeToken, - RegexPatternSetId: r.patternSetid, + RegexPatternSetId: r.patternSetID, Updates: []*waf.RegexPatternSetUpdate{ &waf.RegexPatternSetUpdate{ Action: aws.String("DELETE"), @@ -81,6 +96,6 @@ func (r *WAFRegionalRegexPatternString) Remove() error { func (r *WAFRegionalRegexPatternString) Properties() types.Properties { return types.NewProperties(). - Set("RegexPatternSetID", r.patternSetid). + Set("RegexPatternSetID", r.patternSetID). Set("patternString", r.patternString) } diff --git a/resources/wafregional-rule-predicates.go b/resources/wafregional-rule-predicates.go index d7713c200..18568ea4b 100644 --- a/resources/wafregional-rule-predicates.go +++ b/resources/wafregional-rule-predicates.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRulePredicate struct { - svc *wafregional.WAFRegional - ruleID *string - predicate *waf.Predicate -} +const WAFRegionalRulePredicateResource = "WAFRegionalRulePredicate" func init() { - register("WAFRegionalRulePredicate", ListWAFRegionalRulePredicates) + resource.Register(resource.Registration{ + Name: WAFRegionalRulePredicateResource, + Scope: nuke.Account, + Lister: &WAFRegionalRulePredicateLister{}, + }) } -func ListWAFRegionalRulePredicates(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRulePredicateLister struct{} + +func (l *WAFRegionalRulePredicateLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRulesInput{ Limit: aws.Int64(50), @@ -59,7 +68,13 @@ func ListWAFRegionalRulePredicates(sess *session.Session) ([]Resource, error) { return resources, nil } -func (r *WAFRegionalRulePredicate) Remove() error { +type WAFRegionalRulePredicate struct { + svc *wafregional.WAFRegional + ruleID *string + predicate *waf.Predicate +} + +func (r *WAFRegionalRulePredicate) Remove(_ context.Context) error { tokenOutput, err := r.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-rulegroup.go b/resources/wafregional-rulegroup.go index 10a3d46b3..403080d8a 100644 --- a/resources/wafregional-rulegroup.go +++ b/resources/wafregional-rulegroup.go @@ -1,26 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRuleGroup struct { - svc *wafregional.WAFRegional - ID *string - name *string -} +const WAFRegionalRuleGroupResource = "WAFRegionalRuleGroup" func init() { - register("WAFRegionalRuleGroup", ListWAFRegionalRuleGroups) + resource.Register(resource.Registration{ + Name: WAFRegionalRuleGroupResource, + Scope: nuke.Account, + Lister: &WAFRegionalRuleGroupLister{}, + }) } -func ListWAFRegionalRuleGroups(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRuleGroupLister struct{} + +func (l *WAFRegionalRuleGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRuleGroupsInput{ Limit: aws.Int64(50), @@ -50,8 +59,13 @@ func ListWAFRegionalRuleGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WAFRegionalRuleGroup) Remove() error { +type WAFRegionalRuleGroup struct { + svc *wafregional.WAFRegional + ID *string + name *string +} +func (f *WAFRegionalRuleGroup) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err diff --git a/resources/wafregional-rules.go b/resources/wafregional-rules.go index 30c771abb..50fabd773 100644 --- a/resources/wafregional-rules.go +++ b/resources/wafregional-rules.go @@ -1,27 +1,35 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalRule struct { - svc *wafregional.WAFRegional - ID *string - name *string - rule *waf.Rule -} +const WAFRegionalRuleResource = "WAFRegionalRule" func init() { - register("WAFRegionalRule", ListWAFRegionalRules) + resource.Register(resource.Registration{ + Name: WAFRegionalRuleResource, + Scope: nuke.Account, + Lister: &WAFRegionalRuleLister{}, + }) } -func ListWAFRegionalRules(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalRuleLister struct{} + +func (l *WAFRegionalRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListRulesInput{ Limit: aws.Int64(50), @@ -55,14 +63,21 @@ func ListWAFRegionalRules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WAFRegionalRule) Remove() error { +type WAFRegionalRule struct { + svc *wafregional.WAFRegional + ID *string + name *string + rule *waf.Rule +} + +func (f *WAFRegionalRule) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { return err } - ruleUpdates := []*waf.RuleUpdate{} + var ruleUpdates []*waf.RuleUpdate for _, predicate := range f.rule.Predicates { ruleUpdates = append(ruleUpdates, &waf.RuleUpdate{ Action: aws.String(waf.ChangeActionDelete), diff --git a/resources/wafregional-webacl-rule-attachments.go b/resources/wafregional-webacl-rule-attachments.go index 73ed5ca46..2a6439a7c 100644 --- a/resources/wafregional-webacl-rule-attachments.go +++ b/resources/wafregional-webacl-rule-attachments.go @@ -1,28 +1,37 @@ package resources import ( + "context" + "fmt" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFRegionalWebACLRuleAttachment struct { - svc *wafregional.WAFRegional - webACLID *string - activatedRule *waf.ActivatedRule -} +const WAFRegionalWebACLRuleAttachmentResource = "WAFRegionalWebACLRuleAttachment" func init() { - register("WAFRegionalWebACLRuleAttachment", ListWAFRegionalWebACLRuleAttachments) + resource.Register(resource.Registration{ + Name: WAFRegionalWebACLRuleAttachmentResource, + Scope: nuke.Account, + Lister: &WAFRegionalWebACLRuleAttachmentLister{}, + }) } -func ListWAFRegionalWebACLRuleAttachments(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} - webACLs := []*waf.WebACLSummary{} +type WAFRegionalWebACLRuleAttachmentLister struct{} + +func (l *WAFRegionalWebACLRuleAttachmentLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) + var webACLs []*waf.WebACLSummary params := &waf.ListWebACLsInput{ Limit: aws.Int64(50), @@ -59,7 +68,7 @@ func ListWAFRegionalWebACLRuleAttachments(sess *session.Session) ([]Resource, er for _, webACLRule := range resp.WebACL.Rules { resources = append(resources, &WAFRegionalWebACLRuleAttachment{ svc: svc, - webACLID: webACL.WebACLId, + webAclID: webACL.WebACLId, activatedRule: webACLRule, }) } @@ -69,7 +78,13 @@ func ListWAFRegionalWebACLRuleAttachments(sess *session.Session) ([]Resource, er return resources, nil } -func (f *WAFRegionalWebACLRuleAttachment) Remove() error { +type WAFRegionalWebACLRuleAttachment struct { + svc *wafregional.WAFRegional + webAclID *string + activatedRule *waf.ActivatedRule +} + +func (f *WAFRegionalWebACLRuleAttachment) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { @@ -82,7 +97,7 @@ func (f *WAFRegionalWebACLRuleAttachment) Remove() error { } _, err = f.svc.UpdateWebACL(&waf.UpdateWebACLInput{ - WebACLId: f.webACLID, + WebACLId: f.webAclID, ChangeToken: tokenOutput.ChangeToken, Updates: []*waf.WebACLUpdate{webACLUpdate}, }) @@ -91,5 +106,5 @@ func (f *WAFRegionalWebACLRuleAttachment) Remove() error { } func (f *WAFRegionalWebACLRuleAttachment) String() string { - return fmt.Sprintf("%s -> %s", *f.webACLID, *f.activatedRule.RuleId) + return fmt.Sprintf("%s -> %s", *f.webAclID, *f.activatedRule.RuleId) } diff --git a/resources/wafregional-webacls.go b/resources/wafregional-webacls.go index 873ee89da..49f9dce04 100644 --- a/resources/wafregional-webacls.go +++ b/resources/wafregional-webacls.go @@ -1,11 +1,16 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/waf" "github.com/aws/aws-sdk-go/service/wafregional" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type WAFRegionalWebACL struct { @@ -14,13 +19,23 @@ type WAFRegionalWebACL struct { name *string } +const WAFRegionalWebACLResource = "WAFRegionalWebACL" + func init() { - register("WAFRegionalWebACL", ListWAFRegionalWebACLs) + resource.Register(resource.Registration{ + Name: WAFRegionalWebACLResource, + Scope: nuke.Account, + Lister: &WAFRegionalWebACLLister{}, + }) } -func ListWAFRegionalWebACLs(sess *session.Session) ([]Resource, error) { - svc := wafregional.New(sess) - resources := []Resource{} +type WAFRegionalWebACLLister struct{} + +func (l *WAFRegionalWebACLLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafregional.New(opts.Session) + resources := make([]resource.Resource, 0) params := &waf.ListWebACLsInput{ Limit: aws.Int64(50), @@ -50,7 +65,7 @@ func ListWAFRegionalWebACLs(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WAFRegionalWebACL) Remove() error { +func (f *WAFRegionalWebACL) Remove(_ context.Context) error { tokenOutput, err := f.svc.GetChangeToken(&waf.GetChangeTokenInput{}) if err != nil { diff --git a/resources/wafv2-ipsets.go b/resources/wafv2-ipsets.go index 02472a20e..94760bd09 100644 --- a/resources/wafv2-ipsets.go +++ b/resources/wafv2-ipsets.go @@ -1,28 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/wafv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFv2IPSet struct { - svc *wafv2.WAFV2 - id *string - name *string - lockToken *string - scope *string -} +const WAFv2IPSetResource = "WAFv2IPSet" func init() { - register("WAFv2IPSet", ListWAFv2IPSets, - mapCloudControl("AWS::WAFv2::IPSet")) + resource.Register(resource.Registration{ + Name: WAFv2IPSetResource, + Scope: nuke.Account, + Lister: &WAFv2IPSetLister{}, + }) } -func ListWAFv2IPSets(sess *session.Session) ([]Resource, error) { - svc := wafv2.New(sess) - resources := []Resource{} +type WAFv2IPSetLister struct{} + +func (l *WAFv2IPSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafv2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &wafv2.ListIPSetsInput{ Limit: aws.Int64(50), @@ -31,17 +37,17 @@ func ListWAFv2IPSets(sess *session.Session) ([]Resource, error) { output, err := getIPSets(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) - if *sess.Config.Region == "us-east-1" { + if *opts.Session.Config.Region == "us-east-1" { params.Scope = aws.String("CLOUDFRONT") output, err := getIPSets(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) @@ -50,8 +56,8 @@ func ListWAFv2IPSets(sess *session.Session) ([]Resource, error) { return resources, nil } -func getIPSets(svc *wafv2.WAFV2, params *wafv2.ListIPSetsInput) ([]Resource, error) { - resources := []Resource{} +func getIPSets(svc *wafv2.WAFV2, params *wafv2.ListIPSetsInput) ([]resource.Resource, error) { + resources := make([]resource.Resource, 0) for { resp, err := svc.ListIPSets(params) if err != nil { @@ -78,7 +84,15 @@ func getIPSets(svc *wafv2.WAFV2, params *wafv2.ListIPSetsInput) ([]Resource, err return resources, nil } -func (r *WAFv2IPSet) Remove() error { +type WAFv2IPSet struct { + svc *wafv2.WAFV2 + id *string + name *string + lockToken *string + scope *string +} + +func (r *WAFv2IPSet) Remove(_ context.Context) error { _, err := r.svc.DeleteIPSet(&wafv2.DeleteIPSetInput{ Id: r.id, Name: r.name, diff --git a/resources/wafv2-regex-pattern-sets.go b/resources/wafv2-regex-pattern-sets.go index d0e33bdf6..c11b28538 100644 --- a/resources/wafv2-regex-pattern-sets.go +++ b/resources/wafv2-regex-pattern-sets.go @@ -1,28 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/wafv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFv2RegexPatternSet struct { - svc *wafv2.WAFV2 - id *string - name *string - lockToken *string - scope *string -} +const WAFv2RegexPatternSetResource = "WAFv2RegexPatternSet" func init() { - register("WAFv2RegexPatternSet", ListWAFv2RegexPatternSets, - mapCloudControl("AWS::WAFv2::RegexPatternSet")) + resource.Register(resource.Registration{ + Name: WAFv2RegexPatternSetResource, + Scope: nuke.Account, + Lister: &WAFv2RegexPatternSetLister{}, + }) } -func ListWAFv2RegexPatternSets(sess *session.Session) ([]Resource, error) { - svc := wafv2.New(sess) - resources := []Resource{} +type WAFv2RegexPatternSetLister struct{} + +func (l *WAFv2RegexPatternSetLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafv2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &wafv2.ListRegexPatternSetsInput{ Limit: aws.Int64(50), @@ -31,17 +37,17 @@ func ListWAFv2RegexPatternSets(sess *session.Session) ([]Resource, error) { output, err := getRegexPatternSets(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) - if *sess.Config.Region == "us-east-1" { + if *opts.Session.Config.Region == "us-east-1" { params.Scope = aws.String("CLOUDFRONT") output, err := getRegexPatternSets(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) @@ -50,8 +56,8 @@ func ListWAFv2RegexPatternSets(sess *session.Session) ([]Resource, error) { return resources, nil } -func getRegexPatternSets(svc *wafv2.WAFV2, params *wafv2.ListRegexPatternSetsInput) ([]Resource, error) { - resources := []Resource{} +func getRegexPatternSets(svc *wafv2.WAFV2, params *wafv2.ListRegexPatternSetsInput) ([]resource.Resource, error) { + resources := make([]resource.Resource, 0) for { resp, err := svc.ListRegexPatternSets(params) if err != nil { @@ -78,7 +84,15 @@ func getRegexPatternSets(svc *wafv2.WAFV2, params *wafv2.ListRegexPatternSetsInp return resources, nil } -func (r *WAFv2RegexPatternSet) Remove() error { +type WAFv2RegexPatternSet struct { + svc *wafv2.WAFV2 + id *string + name *string + lockToken *string + scope *string +} + +func (r *WAFv2RegexPatternSet) Remove(_ context.Context) error { _, err := r.svc.DeleteRegexPatternSet(&wafv2.DeleteRegexPatternSetInput{ Id: r.id, Name: r.name, diff --git a/resources/wafv2-rulegroup.go b/resources/wafv2-rulegroup.go index fd570aae0..c71073608 100644 --- a/resources/wafv2-rulegroup.go +++ b/resources/wafv2-rulegroup.go @@ -1,28 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/wafv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFv2RuleGroup struct { - svc *wafv2.WAFV2 - ID *string - name *string - lockToken *string - scope *string -} +const WAFv2RuleGroupResource = "WAFv2RuleGroup" func init() { - register("WAFv2RuleGroup", ListWAFv2RuleGroups, - mapCloudControl("AWS::WAFv2::RuleGroup")) + resource.Register(resource.Registration{ + Name: WAFv2RuleGroupResource, + Scope: nuke.Account, + Lister: &WAFv2RuleGroupLister{}, + }) } -func ListWAFv2RuleGroups(sess *session.Session) ([]Resource, error) { - svc := wafv2.New(sess) - resources := []Resource{} +type WAFv2RuleGroupLister struct{} + +func (l *WAFv2RuleGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafv2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &wafv2.ListRuleGroupsInput{ Limit: aws.Int64(50), @@ -31,17 +37,17 @@ func ListWAFv2RuleGroups(sess *session.Session) ([]Resource, error) { output, err := getRuleGroups(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) - if *sess.Config.Region == "us-east-1" { + if *opts.Session.Config.Region == "us-east-1" { params.Scope = aws.String("CLOUDFRONT") output, err := getRuleGroups(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) @@ -50,8 +56,8 @@ func ListWAFv2RuleGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func getRuleGroups(svc *wafv2.WAFV2, params *wafv2.ListRuleGroupsInput) ([]Resource, error) { - resources := []Resource{} +func getRuleGroups(svc *wafv2.WAFV2, params *wafv2.ListRuleGroupsInput) ([]resource.Resource, error) { + resources := make([]resource.Resource, 0) for { resp, err := svc.ListRuleGroups(params) if err != nil { @@ -77,7 +83,15 @@ func getRuleGroups(svc *wafv2.WAFV2, params *wafv2.ListRuleGroupsInput) ([]Resou return resources, nil } -func (f *WAFv2RuleGroup) Remove() error { +type WAFv2RuleGroup struct { + svc *wafv2.WAFV2 + ID *string + name *string + lockToken *string + scope *string +} + +func (f *WAFv2RuleGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteRuleGroup(&wafv2.DeleteRuleGroupInput{ Id: f.ID, Name: f.name, diff --git a/resources/wafv2-webacls.go b/resources/wafv2-webacls.go index f449dadc0..f98bae79f 100644 --- a/resources/wafv2-webacls.go +++ b/resources/wafv2-webacls.go @@ -1,28 +1,34 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/wafv2" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WAFv2WebACL struct { - svc *wafv2.WAFV2 - ID *string - name *string - lockToken *string - scope *string -} +const WAFv2WebACLResource = "WAFv2WebACL" func init() { - register("WAFv2WebACL", ListWAFv2WebACLs, - mapCloudControl("AWS::WAFv2::WebACL")) + resource.Register(resource.Registration{ + Name: WAFv2WebACLResource, + Scope: nuke.Account, + Lister: &WAFv2WebACLLister{}, + }) } -func ListWAFv2WebACLs(sess *session.Session) ([]Resource, error) { - svc := wafv2.New(sess) - resources := []Resource{} +type WAFv2WebACLLister struct{} + +func (l *WAFv2WebACLLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := wafv2.New(opts.Session) + resources := make([]resource.Resource, 0) params := &wafv2.ListWebACLsInput{ Limit: aws.Int64(50), @@ -31,17 +37,17 @@ func ListWAFv2WebACLs(sess *session.Session) ([]Resource, error) { output, err := getWebACLs(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) - if *sess.Config.Region == "us-east-1" { + if *opts.Session.Config.Region == "us-east-1" { params.Scope = aws.String("CLOUDFRONT") output, err := getWebACLs(svc, params) if err != nil { - return []Resource{}, err + return []resource.Resource{}, err } resources = append(resources, output...) @@ -50,8 +56,8 @@ func ListWAFv2WebACLs(sess *session.Session) ([]Resource, error) { return resources, nil } -func getWebACLs(svc *wafv2.WAFV2, params *wafv2.ListWebACLsInput) ([]Resource, error) { - resources := []Resource{} +func getWebACLs(svc *wafv2.WAFV2, params *wafv2.ListWebACLsInput) ([]resource.Resource, error) { + resources := make([]resource.Resource, 0) for { resp, err := svc.ListWebACLs(params) if err != nil { @@ -77,7 +83,15 @@ func getWebACLs(svc *wafv2.WAFV2, params *wafv2.ListWebACLsInput) ([]Resource, e return resources, nil } -func (f *WAFv2WebACL) Remove() error { +type WAFv2WebACL struct { + svc *wafv2.WAFV2 + ID *string + name *string + lockToken *string + scope *string +} + +func (f *WAFv2WebACL) Remove(_ context.Context) error { _, err := f.svc.DeleteWebACL(&wafv2.DeleteWebACLInput{ Id: f.ID, Name: f.name, diff --git a/resources/workspaces-workspaces.go b/resources/workspaces-workspaces.go index dbb8a34f6..d6ff8a7d6 100644 --- a/resources/workspaces-workspaces.go +++ b/resources/workspaces-workspaces.go @@ -1,23 +1,33 @@ package resources import ( + "context" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/workspaces" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type WorkSpacesWorkspace struct { - svc *workspaces.WorkSpaces - workspaceID *string -} +const WorkSpacesWorkspaceResource = "WorkSpacesWorkspace" func init() { - register("WorkSpacesWorkspace", ListWorkSpacesWorkspaces) + resource.Register(resource.Registration{ + Name: WorkSpacesWorkspaceResource, + Scope: nuke.Account, + Lister: &WorkSpacesWorkspaceLister{}, + }) } -func ListWorkSpacesWorkspaces(sess *session.Session) ([]Resource, error) { - svc := workspaces.New(sess) - resources := []Resource{} +type WorkSpacesWorkspaceLister struct{} + +func (l *WorkSpacesWorkspaceLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := workspaces.New(opts.Session) + resources := make([]resource.Resource, 0) params := &workspaces.DescribeWorkspacesInput{ Limit: aws.Int64(25), @@ -46,20 +56,26 @@ func ListWorkSpacesWorkspaces(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *WorkSpacesWorkspace) Remove() error { +type WorkSpacesWorkspace struct { + svc *workspaces.WorkSpaces + workspaceID *string +} +func (f *WorkSpacesWorkspace) Remove(_ context.Context) error { stopRequest := &workspaces.StopRequest{ WorkspaceId: f.workspaceID, } terminateRequest := &workspaces.TerminateRequest{ WorkspaceId: f.workspaceID, } + _, err := f.svc.StopWorkspaces(&workspaces.StopWorkspacesInput{ StopWorkspaceRequests: []*workspaces.StopRequest{stopRequest}, }) if err != nil { return err } + _, err = f.svc.TerminateWorkspaces(&workspaces.TerminateWorkspacesInput{ TerminateWorkspaceRequests: []*workspaces.TerminateRequest{terminateRequest}, }) diff --git a/resources/xray-group.go b/resources/xray-group.go index d48a02a29..1cecea153 100644 --- a/resources/xray-group.go +++ b/resources/xray-group.go @@ -1,24 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/xray" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type XRayGroup struct { - svc *xray.XRay - groupName *string - groupARN *string -} +const XRayGroupResource = "XRayGroup" func init() { - register("XRayGroup", ListXRayGroups) + resource.Register(resource.Registration{ + Name: XRayGroupResource, + Scope: nuke.Account, + Lister: &XRayGroupLister{}, + }) } -func ListXRayGroups(sess *session.Session) ([]Resource, error) { - svc := xray.New(sess) - resources := []Resource{} +type XRayGroupLister struct{} + +func (l *XRayGroupLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := xray.New(opts.Session) + resources := make([]resource.Resource, 0) // Get X-Ray Groups var xrayGroups []*xray.GroupSummary @@ -48,7 +57,13 @@ func ListXRayGroups(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *XRayGroup) Remove() error { +type XRayGroup struct { + svc *xray.XRay + groupName *string + groupARN *string +} + +func (f *XRayGroup) Remove(_ context.Context) error { _, err := f.svc.DeleteGroup(&xray.DeleteGroupInput{ GroupARN: f.groupARN, // Only allowed to pass GroupARN _or_ GroupName to delete request }) diff --git a/resources/xray-samplingrule.go b/resources/xray-sampling-rule.go similarity index 63% rename from resources/xray-samplingrule.go rename to resources/xray-sampling-rule.go index f33709041..2232ac16f 100644 --- a/resources/xray-samplingrule.go +++ b/resources/xray-sampling-rule.go @@ -1,24 +1,33 @@ package resources import ( - "github.com/aws/aws-sdk-go/aws/session" + "context" + "github.com/aws/aws-sdk-go/service/xray" - "github.com/rebuy-de/aws-nuke/v2/pkg/types" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) -type XRaySamplingRule struct { - svc *xray.XRay - ruleName *string - ruleARN *string -} +const XRaySamplingRuleResource = "XRaySamplingRule" func init() { - register("XRaySamplingRule", ListXRaySamplingRules) + resource.Register(resource.Registration{ + Name: XRaySamplingRuleResource, + Scope: nuke.Account, + Lister: &XRaySamplingRuleLister{}, + }) } -func ListXRaySamplingRules(sess *session.Session) ([]Resource, error) { - svc := xray.New(sess) - resources := []Resource{} +type XRaySamplingRuleLister struct{} + +func (l *XRaySamplingRuleLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + + svc := xray.New(opts.Session) + resources := make([]resource.Resource, 0) var xraySamplingRules []*xray.SamplingRule err := svc.GetSamplingRulesPages( @@ -47,7 +56,13 @@ func ListXRaySamplingRules(sess *session.Session) ([]Resource, error) { return resources, nil } -func (f *XRaySamplingRule) Remove() error { +type XRaySamplingRule struct { + svc *xray.XRay + ruleName *string + ruleARN *string +} + +func (f *XRaySamplingRule) Remove(_ context.Context) error { _, err := f.svc.DeleteSamplingRule(&xray.DeleteSamplingRuleInput{ RuleARN: f.ruleARN, // Specify ruleARN or ruleName, not both }) diff --git a/tools/compare-resources/main.go b/tools/compare-resources/main.go new file mode 100644 index 000000000..5df39c5a2 --- /dev/null +++ b/tools/compare-resources/main.go @@ -0,0 +1,113 @@ +package main + +import ( + "fmt" + "io/fs" + "os" + "path/filepath" + "regexp" + "slices" + "strings" +) + +var OriginalRegisterRegex = regexp.MustCompile("register\\(\"(?P.*)\",\\s?(?P\\w+)(,)?(\\s+mapCloudControl\\(\"(?P.*)\"\\))?") +var NewRegisterRegex = regexp.MustCompile(`resource.Registration{\s+Name:\s+(?P.*),`) + +func main() { + args := os.Args[1:] + + if len(args) == 0 { + panic("no arguments given") + } + + awsNukeDirectory := filepath.Join(args[0], "resources") + + var awsNukeResourceFiles []string + var awsNukeResourceTypes []string + + filepath.WalkDir(awsNukeDirectory, func(path string, di fs.DirEntry, err error) error { + if !strings.HasSuffix(path, ".go") { + return nil + } + + if strings.HasSuffix(path, "_test.go") { + return nil + } + + awsNukeResourceFiles = append(awsNukeResourceFiles, filepath.Base(path)) + return nil + }) + + for _, file := range awsNukeResourceFiles { + originalFileContents, err := os.ReadFile(filepath.Join(awsNukeDirectory, file)) + if err != nil { + panic(err) + } + + matches := OriginalRegisterRegex.FindStringSubmatch(string(originalFileContents)) + + if len(matches) < 3 { + fmt.Printf("WARNING: ERROR no matches in %s\n", file) + continue + } + resourceType := matches[1] + funcName := matches[2] + _ = funcName + + awsNukeResourceTypes = append(awsNukeResourceTypes, resourceType) + } + + var localResourcesPath = filepath.Join("resources") + var localResourceFiles []string + var localResourceTypes []string + + filepath.WalkDir(localResourcesPath, func(path string, di fs.DirEntry, err error) error { + if !strings.HasSuffix(path, ".go") { + return nil + } + + if strings.HasSuffix(path, "_test.go") { + return nil + } + + localResourceFiles = append(localResourceFiles, filepath.Base(path)) + return nil + }) + + for _, file := range localResourceFiles { + originalFileContents, err := os.ReadFile(filepath.Join(localResourcesPath, file)) + if err != nil { + panic(err) + } + + matches := NewRegisterRegex.FindStringSubmatch(string(originalFileContents)) + + var NameRegex = regexp.MustCompile(fmt.Sprintf(`const %s = "(?P.*)"`, matches[1])) + + nameMatches := NameRegex.FindStringSubmatch(string(originalFileContents)) + if len(nameMatches) == 0 { + continue + } + + resourceType := nameMatches[1] + + localResourceTypes = append(localResourceTypes, resourceType) + } + + fmt.Println("\naws-nuke resource count:", len(awsNukeResourceTypes)) + fmt.Println("local resource count:", len(localResourceTypes)) + + fmt.Println("\nResources not in local aws-nuke:") + for _, resource := range awsNukeResourceTypes { + if !slices.Contains(localResourceTypes, resource) { + fmt.Println("->", resource) + } + } + + fmt.Println("\nResources not in aws-nuke:") + for _, resource := range localResourceTypes { + if !slices.Contains(awsNukeResourceTypes, resource) { + fmt.Println("+>", resource) + } + } +} diff --git a/tools/create-resource/main.go b/tools/create-resource/main.go new file mode 100644 index 000000000..f34c3b9b9 --- /dev/null +++ b/tools/create-resource/main.go @@ -0,0 +1,100 @@ +package main + +import ( + "bytes" + "fmt" + "os" + "strings" + "text/template" +) + +const resourceTemplate = `package resources + +import ( + "context" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/{{.Service}}" + + "github.com/ekristen/libnuke/pkg/resource" + "github.com/ekristen/libnuke/pkg/types" + + "github.com/ekristen/aws-nuke/pkg/nuke" +) + +const {{.ResourceType}}Resource = "{{.ResourceType}}" + +func init() { + resource.Register(resource.Registration{ + Name: {{.ResourceType}}Resource, + Scope: nuke.Account, + Lister: &{{.ResourceType}}Lister{}, + }) +} + +type {{.ResourceType}}Lister struct{} + +func (l *{{.ResourceType}}Lister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) + svc := {{.Service}}.New(opts.Session) + var resources []resource.Resource + + // INSERT CODE HERE TO ITERATE AND ADD RESOURCES + + return resources, nil +} + +type {{.ResourceType}} struct { + svc *{{.Service}}.{{.ResourceType}} + id *string + tags []*{{.Service}}.Tag +} + +func (r *{{.ResourceType}}) Remove(_ context.Context) error { + return nil +} + +func (r *{{.ResourceType}}) Properties() types.Properties { + properties := types.NewProperties() + for _, tag := range f.tags { + properties.SetTag(tag.Key, tag.Value) + } + return properties +} + +func (r *{{.ResourceType}}) String() string { + return *r.id +} +` + +func main() { + args := os.Args[1:] + + if len(args) != 2 { + fmt.Println("usage: create-resource ") + os.Exit(1) + } + + service := args[0] + resourceType := args[1] + + data := struct { + Service string + ResourceType string + }{ + Service: strings.ToLower(service), + ResourceType: resourceType, + } + + tmpl, err := template.New("resource").Parse(resourceTemplate) + if err != nil { + panic(err) + } + + var tpl bytes.Buffer + if err := tmpl.Execute(&tpl, data); err != nil { + panic(err) + } + + fmt.Println(tpl.String()) +} diff --git a/tools/gen-mock-test/main.go b/tools/gen-mock-test/main.go deleted file mode 100644 index 922c5e511..000000000 --- a/tools/gen-mock-test/main.go +++ /dev/null @@ -1,105 +0,0 @@ -package main - -import ( - "errors" - "flag" - "fmt" - "os" - "strings" - "text/template" - - "github.com/Masterminds/sprig" - "github.com/iancoleman/strcase" - - _ "github.com/rebuy-de/aws-nuke/v2/resources" -) - -const rawTmpl = `package resources - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/{{ lower .Service }}" - "github.com/golang/mock/gomock" - "github.com/rebuy-de/aws-nuke/v2/mocks/mock_{{ lower .Service }}iface" - "github.com/stretchr/testify/assert" -) - -func Test_Mock_{{ .Service }}{{ .Resource }}_Remove(t *testing.T) { - a := assert.New(t) - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - mock{{ .Service }} := mock_{{ lower .Service }}iface.NewMock{{ .Service }}API(ctrl) - - {{ lower .Service }}{{ .Resource }} := {{ .Service }}{{ .Resource }}{ - svc: mock{{ .Service }}, - // populate fields - } - - mockIAM.EXPECT().{{ .Action }}{{ .ModdedResource }}(gomock.Eq(&{{ lower .Service }}.{{ .Action }}{{ .ModdedResource }}Input{ - // need properties - })).Return(&iam.{{ .Action }}{{ .ModdedResource }}Output{}, nil) - - err := {{ lower .Service }}{{ .Resource }}.Remove() - a.Nil(err) -} -` - -var service string -var resource string -var output string - -func main() { - flag.StringVar(&service, "service", "", "AWS Service Name (eg, IAM, EC2)") - flag.StringVar(&resource, "resource", "", "AWS Resource Name for the Service (eg, Instance, Role, Policy") - flag.StringVar(&output, "output", "stdout", "Where to write the generated code to (default: stdout)") - - flag.Parse() - - if service == "" { - panic(errors.New("please provide a service")) - } - if resource == "" { - panic(errors.New("please provide a resource")) - } - - action := "Delete" - moddedResource := resource - if strings.HasSuffix(resource, "Attachment") { - action = "Detach" - moddedResource = strings.TrimSuffix(resource, "Attachment") - } - - tmpl, err := template.New("test").Funcs(sprig.TxtFuncMap()).Parse(rawTmpl) - if err != nil { - panic(err) - } - - data := struct { - Service string - Resource string - ModdedResource string - Action string - }{ - Service: service, - Resource: resource, - ModdedResource: moddedResource, - Action: action, - } - - var err1 error - out := os.Stdout - if output == "file" { - out, err1 = os.Create(fmt.Sprintf("resources/%s-%s_mock_test.go", strings.ToLower(service), strcase.ToKebab(resource))) - if err != nil { - panic(err1) - } - defer out.Close() - } - - if err := tmpl.Execute(out, data); err != nil { - panic(err) - } -} diff --git a/dev/list-cloudcontrol/main.go b/tools/list-cloudcontrol/main.go similarity index 92% rename from dev/list-cloudcontrol/main.go rename to tools/list-cloudcontrol/main.go index d61c3b078..a00cf2f11 100644 --- a/dev/list-cloudcontrol/main.go +++ b/tools/list-cloudcontrol/main.go @@ -1,18 +1,20 @@ package main import ( + "context" "encoding/json" "fmt" "strings" + "github.com/fatih/color" + "github.com/sirupsen/logrus" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudformation" - "github.com/fatih/color" - "github.com/rebuy-de/aws-nuke/v2/resources" - "github.com/rebuy-de/rebuy-go-sdk/v4/pkg/cmdutil" - "github.com/sirupsen/logrus" + + "github.com/ekristen/aws-nuke/pkg/nuke" ) type CFTypeSchema struct { @@ -20,7 +22,7 @@ type CFTypeSchema struct { } func main() { - ctx := cmdutil.SignalRootContext() + ctx := context.Background() sess, err := session.NewSession(&aws.Config{ Region: aws.String(endpoints.UsEast1RegionID), @@ -31,7 +33,7 @@ func main() { cf := cloudformation.New(sess) - mapping := resources.GetCloudControlMapping() + mapping := nuke.GetCloudControlMapping() in := &cloudformation.ListTypesInput{ Type: aws.String(cloudformation.RegistryTypeResource), diff --git a/tools/migrate-resource/main.go b/tools/migrate-resource/main.go new file mode 100644 index 000000000..2a9137a66 --- /dev/null +++ b/tools/migrate-resource/main.go @@ -0,0 +1,111 @@ +package main + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "regexp" + "strings" + "text/template" +) + +var resourceTemplate = `const {{.ResourceType}}Resource = "{{.ResourceType}}" + +func init() { + resource.Register(resource.Registration{ + Name: {{.ResourceType}}Resource, + Scope: nuke.Account, + Lister: &{{.ResourceType}}Lister{}, + }) +} + +type {{.ResourceType}}Lister struct{}` + +var funcTemplate = `func (l *{{.ResourceType}}Lister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { + opts := o.(*nuke.ListerOpts) +` + +var imports = `import ( + "context" + + "github.com/ekristen/libnuke/pkg/resource" + + "github.com/ekristen/aws-nuke/pkg/nuke" +` + +func main() { + args := os.Args[1:] + + if len(args) == 0 { + panic("no arguments given") + } + + originalSourceDir := filepath.Join(args[0], "resources") + + repl := regexp.MustCompile("func init\\(\\) {\\s+.*[\\s+].*\\s}") + match := regexp.MustCompile("register\\(\"(?P.*)\",\\s?(?P\\w+)(,)?(\\s+mapCloudControl\\(\"(?P.*)\"\\))?") + funcMatch := regexp.MustCompile("func List.*{") + + filename := filepath.Join(originalSourceDir, "resources", args[0]+".go") + + originalFileContents, err := os.ReadFile(filename) + if err != nil { + panic(err) + } + + matches := match.FindStringSubmatch(string(originalFileContents)) + + if len(matches) < 3 { + panic("no matches") + } + resourceType := matches[1] + funcName := matches[2] + cc := "" + if len(matches) == 4 { + cc = matches[3] + } + + fmt.Println(cc) + fmt.Println(funcName) + + data := struct { + ResourceType string + }{ + ResourceType: resourceType, + } + + tmpl, err := template.New("resource").Parse(resourceTemplate) + if err != nil { + panic(err) + } + + var tpl bytes.Buffer + if err := tmpl.Execute(&tpl, data); err != nil { + panic(err) + } + + funcTmpl, err := template.New("function").Parse(funcTemplate) + if err != nil { + panic(err) + } + + var funcTpl bytes.Buffer + if err := funcTmpl.Execute(&funcTpl, data); err != nil { + panic(err) + } + + newContents := repl.ReplaceAllString(string(originalFileContents), tpl.String()) + newContents = strings.ReplaceAll(newContents, "github.com/rebuy-de/aws-nuke/v2/pkg/types", "github.com/ekristen/libnuke/pkg/types") + newContents = funcMatch.ReplaceAllString(newContents, funcTpl.String()) + newContents = strings.ReplaceAll(newContents, "[]Resource", "[]resource.Resource") + newContents = strings.ReplaceAll(newContents, "(sess)", "(opts.Session)") + newContents = strings.ReplaceAll(newContents, "resources := []resource.Resource{}", "resources := make([]resource.Resource, 0)") + newContents = strings.ReplaceAll(newContents, "import (", imports) + newContents = strings.ReplaceAll(newContents, "\"github.com/aws/aws-sdk-go/aws/session\"", "") + newContents = strings.ReplaceAll(newContents, "\"github.com/rebuy-de/aws-nuke/v2/pkg/config\"", "\"github.com/ekristen/libnuke/pkg/featureflag\"") + newContents = strings.ReplaceAll(newContents, "config.FeatureFlags", "*featureflag.FeatureFlags") + newContents = strings.ReplaceAll(newContents, ") Remove() error {", ") Remove(_ context.Context) error {") + + os.WriteFile(filepath.Join(".", "resources", args[0]+".go"), []byte(newContents), 0644) +} diff --git a/tools/tools.go b/tools/tools.go deleted file mode 100644 index 6f89b957f..000000000 --- a/tools/tools.go +++ /dev/null @@ -1,8 +0,0 @@ -// +build tools - -package main - -// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module -import ( - _ "github.com/golang/mock/mockgen" -)