fix: install tools using go.mod for versioning (#2562)

* fix: install tools using go.mod for versioning

* Add helpful instructions for tool updates.

* Add comment

* Add boilerplate

* Update go.mod

* Gofmt feedback
This commit is contained in:
Liam Newman 2023-06-14 10:18:13 -07:00 committed by GitHub
parent e01e67074a
commit 5cbc06369e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
292 changed files with 44525 additions and 3790 deletions

View File

@ -25,38 +25,30 @@ ENV GOOS=$TARGETOS
ENV CGO_ENABLED=0
ENV GOBIN=/usr/local/bin
# Get GCR credential helper
# Until https://github.com/GoogleCloudPlatform/docker-credential-gcr/issues/128 is addressed, we need to use
# the existing compiled versions distributed in GitHub releases
ARG GCR_HELPER_VERSION="2.1.8"
# Checksums can be obtained from https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.8/checksums.txt
ARG GCR_HELPER_SHA_linux_amd64="0da9a0878d34dc8b38ae76519b7137f3179f573cf9c84fec1b81e973b565e2f9"
ARG GCR_HELPER_SHA_linux_386="2421d3242beb239eb640daf9dbfa4582416049a92ed93a207a0a3102fde4ea11"
ARG GCR_HELPER_SHA_linux_s390x="5d18e62c5952d43993b7ee292f87d812ccd161d4e9d932fbc1567eb5d5013632"
ARG GCR_HELPER_SHA_linux_arm64="9d0e67c18fb3e1e048120d06edb9e54e1c11f88139ec77dbc9830e8a8b31745c"
# There is no linux/ppc64le available for docker-credential-gcr, at least let's install it using go install pointing to the tag's commit
RUN if [ "$TARGETARCH" = "ppc64le" ]; then \
GCR_HELPER_COMMIT=$(git ls-remote -t https://github.com/GoogleCloudPlatform/docker-credential-gcr v$GCR_HELPER_VERSION | head -1 | awk '{print $1}') \
&& go install github.com/GoogleCloudPlatform/docker-credential-gcr@${GCR_HELPER_COMMIT}; \
else \
curl -fsSL -o /tmp/gcr-helper.tar.gz https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v${GCR_HELPER_VERSION}/docker-credential-gcr_${TARGETOS}_${TARGETARCH}-${GCR_HELPER_VERSION}.tar.gz \
&& eval "GCR_HELPER_SHA=\${GCR_HELPER_SHA_${TARGETOS}_${TARGETARCH}}" \
&& echo "${GCR_HELPER_SHA} /tmp/gcr-helper.tar.gz" | sha256sum -c - \
&& tar -xzf /tmp/gcr-helper.tar.gz --directory /usr/local/bin/; \
fi
# Get Amazon ECR credential helper
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@adf1bafd791ae7d4ff098108b1e91f36a4da5404 # v0.7.1
# Get ACR docker env credential helper
RUN go install github.com/chrismellard/docker-credential-acr-env@82a0ddb2758901b711d9d1614755b77e401598a1
# Add .docker config dir
RUN mkdir -p /kaniko/.docker
COPY . .
# dependencies https://github.com/golang/go/issues/48332
# The versions of these tools and their transitive dependencies are controlled via go.mod.
# To update the version of any tool installed here, run
#
# go get <tool>@<commit-sha-or-tag>
# go mod vendor
#
# Then submit a PR with the changes to `go.mod`, `go.sum`, and `vendor`.
# Get GCR credential helper
RUN go install github.com/GoogleCloudPlatform/docker-credential-gcr
# Get Amazon ECR credential helper
RUN go install github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
# Get ACR docker env credential helper
RUN go install github.com/chrismellard/docker-credential-acr-env
RUN \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \

27
go.mod
View File

@ -1,15 +1,20 @@
module github.com/GoogleContainerTools/kaniko
go 1.17
go 1.19
require (
cloud.google.com/go/storage v1.30.1
github.com/Azure/azure-storage-blob-go v0.14.0
// This docker-credential-gcr dependency version is actually the same as v2.1.8.
// See https://github.com/GoogleCloudPlatform/docker-credential-gcr/issues/128
// To update run: go get github.com/GoogleCloudPlatform/docker-credential-gcr@<commit-sha>
// The version string is a side-effect of Go module version numbering rules. Functionality is otherwise unchanged.
github.com/GoogleCloudPlatform/docker-credential-gcr v1.5.1-0.20230328182921-62afb2723512
github.com/aws/aws-sdk-go-v2 v1.18.0
github.com/aws/aws-sdk-go-v2/config v1.18.25
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.67
github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220228164355-396b2034c795
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230522190001-adf1bafd791a
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589
github.com/containerd/cgroups v1.1.0 // indirect
github.com/docker/docker v23.0.5+incompatible
@ -104,7 +109,6 @@ require (
github.com/googleapis/gax-go/v2 v2.10.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.2 // indirect
github.com/hashicorp/go-uuid v1.0.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@ -157,14 +161,27 @@ require (
require (
github.com/Azure/azure-sdk-for-go v61.3.0+incompatible // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.15.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.12.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.18.10 // indirect
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.16.1 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/subcommands v1.2.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/moby/swarmkit/v2 v2.0.0-20230315203717-e28e8ba9bc83 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/skeema/knownhosts v1.1.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/toqueteos/webbrowser v1.2.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

2761
go.sum

File diff suppressed because it is too large Load Diff

28
tools/tools.go Normal file
View File

@ -0,0 +1,28 @@
//go:build tools
// +build tools
/*
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package tools
// dependencies https://github.com/golang/go/issues/48332
// These are placeholder imports the make go mod include these tools in its dependency graph.
import (
_ "github.com/GoogleCloudPlatform/docker-credential-gcr"
_ "github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login"
_ "github.com/chrismellard/docker-credential-acr-env"
)

View File

@ -0,0 +1,13 @@
.gitignore~
.project
bin
bazel*
*/test_config.json
*/test_credential_store.json
**/testdata
docker-credential-gcr
.idea
*.iml
dist/
*.ipr
*.iws

View File

@ -0,0 +1,32 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# Needed because we use go modules.
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
ldflags:
- "-s -w -X github.com/GoogleCloudPlatform/docker-credential-gcr/config.Version={{.Version}}"
goarch:
- amd64
- arm64
- 386
- s390x
goos:
- linux
- windows
- darwin
archives:
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}-{{ .Version }}"
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Version }}"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

View File

@ -0,0 +1,35 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@bazel_gazelle//:def.bzl", "gazelle")
licenses(["notice"]) # Apache 2.0
exports_files(["LICENSE"])
gazelle(
name = "gazelle",
command = "fix",
external = "vendored",
extra_args = [
"-build_file_name",
"BUILD,BUILD.bazel", # Prioritize `BUILD` for newly added files.
],
prefix = "github.com/GoogleCloudPlatform/docker-credential-gcr",
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr",
visibility = ["//visibility:private"],
deps = [
"//cli:go_default_library",
"//vendor/github.com/google/subcommands:go_default_library",
],
)
go_binary(
name = "docker-credential-gcr",
embed = [":go_default_library"],
pure = "on",
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,101 @@
# Contributing to docker-credential-gcr
## <a name="cla"></a> Sign the CLA
Contributions to any Google project must be accompanied by a Contributor License Agreement. This is not a copyright **assignment**, it simply gives Google permission to use and redistribute your contributions as part of the project. Head over to <https://cla.developers.google.com/> to see your current agreements on file or to sign a new one. You may make a pull request before you have signed a CLA, but the request will not be merged until you have.
You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
## <a name="submit"></a> Submission Guidelines
### Submitting a Pull Request
Before you submit your pull request consider the following guidelines:
* Search [GitHub](https://github.com/GoogleCloudPlatform/docker-credential-gcr/pulls) for an open or closed Pull Request that relates to your submission.
* Please sign our [Contributor License Agreement (CLA)](#cla) before sending pull requests. We cannot accept code without this.
* Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
```
* Create your patch, **including appropriate test cases**.
* Follow our [Coding Rules](#rules).
* Run the full test suite.
```shell
go build
go test -timeout 10s -v ./...
```
* Commit your changes using a descriptive commit message.
```shell
git commit -a -m "omg y u bad @ coding"
```
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
* Push your branch to GitHub:
```shell
git push origin my-fix-branch
```
* In GitHub, send a pull request to `docker-credential-gcr:master`.
* If we suggest changes then:
* Make the required updates.
* Re-run the test suite to ensure tests are still passing.
* Commit your changes to your branch (e.g. `my-fix-branch`).
* Push the changes to your GitHub repository (this will update your Pull Request).
If the PR gets too outdated we may ask you to rebase and force push to update the PR:
```shell
git rebase master -i
git push origin my-fix-branch -f
```
*WARNING. Squashing or reverting commits and forced push thereafter may remove GitHub comments on code that were previously made by you and others in your commits.*
That's it! Thank you for your contribution!
#### After your pull request is merged
After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
```shell
git push origin --delete my-fix-branch
```
* Check out the master branch:
```shell
git checkout master -f
```
* Delete the local branch:
```shell
git branch -D my-fix-branch
```
* Update your master with the latest upstream version:
```shell
git pull --ff upstream master
```
## <a name="rules"></a> Coding Rules
* Go source code should follow the conventions given in [Effective Go](https://golang.org/doc/effective_go.html).
* Source files must be formatted with `gofmt` and updated with `go fix` before submission.
```shell
go fmt
go fix
```
* Source files should be inspected by `go vet`. Since there may be false positives with both, ignored warnings require justification but won't necessarily block changes.
```shell
go vet
```

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,138 @@
<a href="https://gcr.io"><img src="https://avatars2.githubusercontent.com/u/21046548?s=400&v=4" height="120"/></a>
# docker-credential-gcr [![Build Status](https://github.com/GoogleCloudPlatform/docker-credential-gcr/actions/workflows/test.yml/badge.svg)](https://travis-ci.org/GoogleCloudPlatform/docker-credential-gcr) [![Go Report Card](https://goreportcard.com/badge/GoogleCloudPlatform/docker-credential-gcr)](https://goreportcard.com/report/GoogleCloudPlatform/docker-credential-gcr)
## Introduction
`docker-credential-gcr` is [Google Container Registry](https://cloud.google.com/container-registry/)'s _standalone_, `gcloud` SDK-independent Docker credential helper. It allows for **v18.03+ Docker clients** to easily make authenticated requests to GCR's repositories (gcr.io, eu.gcr.io, etc.).
**Note:** `docker-credential-gcr` is primarily intended for users wishing to authenticate with GCR in the **absence of `gcloud`**, though they are [not mutually exclusive](#gcr-credentials). For normal development setups, users are encouraged to use [`gcloud auth configure-docker`](https://cloud.google.com/sdk/gcloud/reference/auth/configure-docker), instead.
The helper implements the [Docker Credential Store](https://docs.docker.com/engine/reference/commandline/login/#/credentials-store) API, but enables more advanced authentication schemes for GCR's users. In particular, it respects [Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials) and is capable of generating credentials automatically (without an explicit login operation) when running in App Engine or Compute Engine.
For even more authentication options, see GCR's documentation on [advanced authentication methods](https://cloud.google.com/container-registry/docs/advanced-authentication).
## GCR Credentials
_By default_, the helper searches for GCR credentials in the following order:
1. In the helper's private credential store (i.e. those stored via `docker-credential-gcr gcr-login`)
1. In a JSON file whose path is specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable.
1. In a JSON file in a location known to the helper:
* On Windows, this is `%APPDATA%/gcloud/application_default_credentials.json`.
* On other systems, `$HOME/.config/gcloud/application_default_credentials.json`.
1. On Google App Engine, it uses the `appengine.AccessToken` function.
1. On Google Compute Engine, Kubernetes Engine, and App Engine Managed VMs, it fetches the credentials of the _service account_ associated with the VM from the metadata server (if available).
Users may limit, re-order how the helper searches for GCR credentials using `docker-credential-gcr config --token-source`. Number 1 above is designated by `store` and 2-5 by `env` (which cannot be individually restricted or re-ordered). Multiple sources are separated by commas, and the default is `"store, env"`.
While it is recommended to use [`gcloud auth configure-docker`](https://cloud.google.com/sdk/gcloud/reference/auth/configure-docker) in `gcloud`-based work flows, you may optionally configure `docker-credential-gcr` to use `gcloud` as a token source (see example below).
**Examples:**
To use _only_ the gcloud SDK's access token:
```shell
docker-credential-gcr config --token-source="gcloud"
```
To search the environment, followed by the private store:
```shell
docker-credential-gcr config --token-source="env, store"
```
To verify that credentials are being returned for a given registry, e.g. for `https://gcr.io`:
```shell
echo "https://gcr.io" | docker-credential-gcr get
```
## Other Credentials
As of the 2.0 release, `docker-credential-gcr` no longer supports generalized [`credsStore`](https://docs.docker.com/engine/reference/commandline/login/#/credentials-store) functionality.
### Building from Source
The program in this repository is written with the Go programming language and can be built with `go build`. These instructions assume you are using [**Go 1.13+**](https://golang.org/) or higher.
You can download the source code, compile the binary, and put it in your `$GOPATH` with `go get`.
```shell
go get -u github.com/GoogleCloudPlatform/docker-credential-gcr
```
If `$GOPATH/bin` is in your system `$PATH`, this will also automatically install the compiled binary. You can confirm using `which docker-credential-gcr` and continue to the [section on Configuration and Usage](#configuration-and-usage).
Alternatively, you can use `go build` to build the program. This creates a `docker-credential-gcr` executable.
```shell
cd $GOPATH/src/github.com/GoogleCloudPlatform/docker-credential-gcr
go build
```
Then, you can put that binary in your `$PATH` to make it visible to `docker`. For example, if `/usr/bin` is present in your system path:
```shell
sudo mv ./docker-credential-gcr /usr/bin/docker-credential-gcr
```
## Configuration and Usage
* Configure the Docker CLI to use `docker-credential-gcr` as a credential helper for the default set of GCR registries:
```shell
docker-credential-gcr configure-docker
```
To speed up `docker build`s, you can instead configure a minimal set of registries:
```shell
docker-credential-gcr configure-docker --registries="eu.gcr.io, marketplace.gcr.io"
```
* Alternatively, use the [manual configuration instructions](#manual-docker-client-configuration) below to configure your version of the Docker client.
* Log in to GCR (or don't! See the [GCR Credentials section](#gcr-credentials))
```shell
docker-credential-gcr gcr-login
```
* Use Docker!
```shell
docker pull gcr.io/project-id/neato-container
```
* Log out from GCR
```shell
docker-credential-gcr gcr-logout
```
### Manual Docker Client Configuration
Add a `credHelpers` entry in the Docker config file (usually `~/.docker/config.json` on OSX and Linux, `%USERPROFILE%\.docker\config.json` on Windows) for each GCR registry that you care about. The key should be the domain of the registry (**without** the "https://") and the value should be the suffix of the credential helper binary (everything after "docker-credential-").
e.g. for `docker-credential-gcr`:
<pre>
{
"auths" : {
...
},
"credHelpers": {
"coolregistry.com": ... ,
<b>"gcr.io": "gcr",
"asia.gcr.io": "gcr",
...</b>
},
"HttpHeaders": ...
"psFormat": ...
"imagesFormat": ...
"detachKeys": ...
}
</pre>
## License
Apache 2.0. See [LICENSE](LICENSE) for more information.

View File

@ -0,0 +1,29 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.20.0/rules_go-v0.20.0.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.20.0/rules_go-v0.20.0.tar.gz",
],
sha256 = "078f2a9569fa9ed846e60805fb5fb167d6f6c4ece48e6d409bf5fb2154eaf0d8",
)
http_archive(
name = "bazel_gazelle",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.19.0/bazel-gazelle-v0.19.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.19.0/bazel-gazelle-v0.19.0.tar.gz",
],
sha256 = "41bff2a0b32b02f20c227d234aa25ef3783998e5453f7eade929704dcff7cd4b",
)
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()

View File

@ -0,0 +1,23 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["login.go"],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr/auth",
visibility = ["//visibility:public"],
deps = [
"//config:go_default_library",
"//vendor/github.com/toqueteos/webbrowser:go_default_library",
"//vendor/golang.org/x/oauth2:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["login_integration_test.go"],
embed = [":go_default_library"],
deps = [
"//config:go_default_library",
"//vendor/golang.org/x/oauth2:go_default_library",
],
)

View File

@ -0,0 +1,227 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package auth implements the logic required to authenticate the user and
generate access tokens for use with GCR.
*/
package auth
import (
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httputil"
"os"
"strings"
"github.com/GoogleCloudPlatform/docker-credential-gcr/config"
"github.com/toqueteos/webbrowser"
"golang.org/x/oauth2"
)
const redirectURIAuthCodeInTitleBar = "urn:ietf:wg:oauth:2.0:oob"
// GCRLoginAgent implements the OAuth2 login dance, generating an Oauth2 access_token
// for the user. If AllowBrowser is set to true, the agent will attempt to
// obtain an authorization_code automatically by executing OpenBrowser and
// reading the redirect performed after a successful login. Otherwise, it will
// attempt to use In and Out to direct the user to the login portal and receive
// the authorization_code in response.
type GCRLoginAgent struct {
// Read input from here; if nil, uses os.Stdin.
In io.Reader
// Write output to here; if nil, uses os.Stdout.
Out io.Writer
// Open the browser for the given url. If nil, uses webbrowser.Open.
OpenBrowser func(url string) error
}
// populate missing fields as described in the struct definition comments
func (a *GCRLoginAgent) init() {
if a.In == nil {
a.In = os.Stdin
}
if a.Out == nil {
a.Out = os.Stdout
}
if a.OpenBrowser == nil {
a.OpenBrowser = webbrowser.Open
}
}
// PerformLogin performs the auth dance necessary to obtain an
// authorization_code from the user and exchange it for an Oauth2 access_token.
func (a *GCRLoginAgent) PerformLogin() (*oauth2.Token, error) {
a.init()
conf := &oauth2.Config{
ClientID: config.GCRCredHelperClientID,
ClientSecret: config.GCRCredHelperClientNotSoSecret,
Scopes: config.GCRScopes,
Endpoint: config.GCROAuth2Endpoint,
}
verifier, challenge, method, err := codeChallengeParams()
state, err := makeRandString(16)
if err != nil {
return nil, fmt.Errorf("Unable to build random string: %v", err)
}
authCodeOpts := []oauth2.AuthCodeOption{
oauth2.AccessTypeOffline,
oauth2.SetAuthURLParam("code_challenge", challenge),
oauth2.SetAuthURLParam("code_challenge_method", method),
}
// Browser based auth is the only mechanism supported now.
// Attempt to receive the authorization code via redirect URL
ln, port, err := getListener()
if err != nil {
return nil, fmt.Errorf("Unable to open local listener: %v", err)
}
defer ln.Close()
// open a web browser and listen on the redirect URL port
conf.RedirectURL = fmt.Sprintf("http://localhost:%d", port)
url := conf.AuthCodeURL(state, authCodeOpts...)
err = a.OpenBrowser(url)
if err != nil {
return nil, fmt.Errorf("Unable to open browser: %v", err)
}
code, err := handleCodeResponse(ln, state)
if err != nil {
return nil, fmt.Errorf("Response was invalid: %v", err)
}
return conf.Exchange(
config.OAuthHTTPContext,
code,
oauth2.SetAuthURLParam("code_verifier", verifier))
}
func (a *GCRLoginAgent) codeViaPrompt(conf *oauth2.Config, authCodeOpts []oauth2.AuthCodeOption) (string, error) {
// Direct the user to our login portal
conf.RedirectURL = redirectURIAuthCodeInTitleBar
url := conf.AuthCodeURL("state", authCodeOpts...)
fmt.Fprintln(a.Out, "Please visit the following URL and complete the authorization dialog:")
fmt.Fprintf(a.Out, "%v\n", url)
// Receive the authorization_code in response
fmt.Fprintln(a.Out, "Authorization code:")
var code string
if _, err := fmt.Fscan(a.In, &code); err != nil {
return "", err
}
return code, nil
}
func getListener() (net.Listener, int, error) {
laddr := net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 0} // port: 0 == find free port
ln, err := net.ListenTCP("tcp4", &laddr)
if err != nil {
return nil, 0, err
}
return ln, ln.Addr().(*net.TCPAddr).Port, nil
}
func handleCodeResponse(ln net.Listener, stateCheck string) (string, error) {
conn, err := ln.Accept()
if err != nil {
return "", err
}
srvConn := httputil.NewServerConn(conn, nil)
defer srvConn.Close()
req, err := srvConn.Read()
if err != nil {
return "", err
}
code := req.URL.Query().Get("code")
state := req.URL.Query().Get("state")
resp := &http.Response{
StatusCode: 200,
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
Close: true,
ContentLength: -1, // designates unknown length
}
defer srvConn.Write(req, resp)
// If the code couldn't be obtained, inform the user via the browser and
// return an error.
// TODO i18n?
if code == "" {
err := fmt.Errorf("Code not present in response: %s", req.URL.String())
resp.Body = getResponseBody("ERROR: Authentication code not present in response.")
return "", err
}
if state != stateCheck {
err := fmt.Errorf("Invalid State")
resp.StatusCode = 400
resp.Body = getResponseBody("ERROR: State parameter is invalid.")
return "", err
}
resp.Body = getResponseBody("Success! You may now close your browser.")
return code, nil
}
// turn a string into an io.ReadCloser as required by an http.Response
func getResponseBody(body string) io.ReadCloser {
reader := strings.NewReader(body)
return ioutil.NopCloser(reader)
}
// generates the values used in "Proof Key for Code Exchange by OAuth Public Clients"
// https://tools.ietf.org/html/rfc7636
// https://developers.google.com/identity/protocols/OAuth2InstalledApp#step1-code-verifier
func codeChallengeParams() (verifier, challenge, method string, err error) {
// A `code_verifier` is a high-entropy cryptographic random string using the unreserved characters
// [A-Z] / [a-z] / [0-9] / "-" / "." / "_" / "~"
// with a minimum length of 43 characters and a maximum length of 128 characters.
verifier, err = makeRandString(32)
if err != nil {
return "", "", "", err
}
// https://tools.ietf.org/html/rfc7636#section-4.2
// If the client is capable of using "S256", it MUST use "S256":
// code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))
sha := sha256.Sum256([]byte(verifier))
challenge = base64.RawURLEncoding.EncodeToString(sha[:])
return verifier, challenge, "S256", nil
}
func makeRandString(length int) (string, error) {
b := make([]byte, length)
_, err := rand.Read(b)
if err != nil {
return "", err
}
return base64.RawURLEncoding.EncodeToString(b), nil
}

View File

@ -0,0 +1,27 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"clear.go",
"common.go",
"config.go",
"configure-docker.go",
"dockerHelper.go",
"gcr-login.go",
"gcr-logout.go",
"version.go",
],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr/cli",
visibility = ["//visibility:public"],
deps = [
"//auth:go_default_library",
"//config:go_default_library",
"//credhelper:go_default_library",
"//store:go_default_library",
"//vendor/github.com/docker/cli/cli/config:go_default_library",
"//vendor/github.com/docker/cli/cli/config/configfile:go_default_library",
"//vendor/github.com/docker/docker-credential-helpers/credentials:go_default_library",
"//vendor/github.com/google/subcommands:go_default_library",
],
)

View File

@ -0,0 +1,58 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
import (
"context"
"flag"
"fmt"
"os"
"github.com/GoogleCloudPlatform/docker-credential-gcr/store"
"github.com/google/subcommands"
)
type clearCmd struct {
cmd
}
// NewClearSubcommand returns a subcommands.Command which removes all stored
// credentials.
func NewClearSubcommand() subcommands.Command {
return &clearCmd{
cmd{
name: "clear",
synopsis: "remove all stored credentials",
},
}
}
func (c *clearCmd) Execute(context.Context, *flag.FlagSet, ...interface{}) subcommands.ExitStatus {
if err := c.ClearAll(); err != nil {
fmt.Fprintf(os.Stderr, "failure: %v\n", err)
return subcommands.ExitFailure
}
return subcommands.ExitSuccess
}
// ClearAll removes all credentials from the store (GCR or otherwise).
func (c *clearCmd) ClearAll() error {
s, err := store.DefaultGCRCredStore()
if err != nil {
return err
}
return s.DeleteGCRAuth()
}

View File

@ -0,0 +1,42 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package cli contains the implementations of all of the subcommands that are
exposed via the command line.
*/
package cli
import (
"flag"
"fmt"
)
type cmd struct {
name, synopsis string
}
// Name returns the name of the command.
func (c *cmd) Name() string { return c.name }
// Synopsis returns the synopsis of the command.
func (c *cmd) Synopsis() string { return c.synopsis }
// Usage returns the name of the command followed by its synopsis and a new line.
func (c *cmd) Usage() string {
return fmt.Sprintf("%s: %s\n", c.Name(), c.Synopsis())
}
// SetFlags is a no-op in order to implement the Command interface.
func (*cmd) SetFlags(*flag.FlagSet) {}

View File

@ -0,0 +1,122 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
import (
"context"
"encoding/csv"
"flag"
"fmt"
"os"
"strings"
"github.com/GoogleCloudPlatform/docker-credential-gcr/config"
"github.com/google/subcommands"
)
const (
tokenSourceFlag = "token-source"
resetAllFlag = "unset-all"
)
type configCmd struct {
cmd
tokenSources string
resetAll bool
}
// NewConfigSubcommand returns a subcommands.Command which allows for user
// configuration of cred helper behavior.
func NewConfigSubcommand() subcommands.Command {
return &configCmd{
cmd{
name: "config",
synopsis: "configure the credential helper",
},
// Because only specified flags are iterated by FlagSet.Visit,
// these values will always be explicitly set by the user if visited.
"unused",
false,
}
}
func (c *configCmd) SetFlags(fs *flag.FlagSet) {
srcs := make([]string, 0, len(config.SupportedGCRTokenSources))
for src := range config.SupportedGCRTokenSources {
srcs = append(srcs, src)
}
supportedSources := strings.Join(srcs, ", ")
defaultSources := strings.Join(config.DefaultTokenSources[:], ", ")
fs.StringVar(&c.tokenSources, tokenSourceFlag, defaultSources, "The source(s), in order, to search for credentials. Supported sources are: "+supportedSources)
fs.BoolVar(&c.resetAll, resetAllFlag, false, "Resets all settings to default")
}
func (c *configCmd) Execute(_ context.Context, flags *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
if c.resetAll {
if err := resetAll(); err != nil {
printError(resetAllFlag, err)
return subcommands.ExitFailure
}
printSuccess("Config reset.")
return subcommands.ExitSuccess
}
result := subcommands.ExitSuccess
flags.Visit(func(f *flag.Flag) {
if f.Name == tokenSourceFlag {
if err := setTokenSources(c.tokenSources); err != nil {
printError(tokenSourceFlag, err)
result = subcommands.ExitFailure
return
}
printSuccess("Token source(s) set.")
result = subcommands.ExitSuccess
}
})
return result
}
func resetAll() error {
cfg, err := config.LoadUserConfig()
if err != nil {
return err
}
return cfg.ResetAll()
}
func setTokenSources(rawSource string) error {
cfg, err := config.LoadUserConfig()
if err != nil {
return err
}
strReader := strings.NewReader(rawSource)
sources, err := csv.NewReader(strReader).Read()
if err != nil {
return err
}
for i, src := range sources {
sources[i] = strings.TrimSpace(src)
}
return cfg.SetTokenSources(sources)
}
func printSuccess(msg string) {
fmt.Fprintf(os.Stdout, "Success: %s\n", msg)
}
func printError(flag string, err error) {
fmt.Fprintf(os.Stderr, "Failure: %s: %v\n", flag, err)
}

View File

@ -0,0 +1,145 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
import (
"context"
"encoding/csv"
"flag"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/GoogleCloudPlatform/docker-credential-gcr/config"
cliconfig "github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/configfile"
"github.com/google/subcommands"
)
type dockerConfigCmd struct {
cmd
// overwrite any previously configured credential store and/or credentials
overwrite bool
// the registries to configure the cred helper for
registries string
// whether to include all AR Registries
includeArtifactRegistry bool
}
// see https://github.com/docker/docker/blob/master/cliconfig/credentials/native_store.go
const credHelperPrefix = "docker-credential-"
// NewDockerConfigSubcommand returns a subcommands.Command which configures
// the docker client to use this credential helper
func NewDockerConfigSubcommand() subcommands.Command {
return &dockerConfigCmd{
cmd{
name: "configure-docker",
synopsis: fmt.Sprintf("configures the Docker client to use %s", os.Args[0]),
},
false,
"unused",
false,
}
}
func (c *dockerConfigCmd) SetFlags(fs *flag.FlagSet) {
fs.BoolVar(&c.overwrite, "overwrite", false, "overwrite any previously configured credential store and/or credentials")
fs.BoolVar(&c.includeArtifactRegistry, "include-artifact-registry", false, "include all Artifact Registry registries as well as GCR registries ")
fs.StringVar(&c.registries, "registries", "", "the comma-separated list of registries to configure the cred helper for")
}
func (c *dockerConfigCmd) Execute(context.Context, *flag.FlagSet, ...interface{}) subcommands.ExitStatus {
binaryName := filepath.Base(os.Args[0])
if !strings.HasPrefix(binaryName, credHelperPrefix) {
printErrorln("Binary name must be prefixed with '%s': %s", credHelperPrefix, binaryName)
return subcommands.ExitFailure
}
// the Docker client can only use binaries on the $PATH
if _, err := exec.LookPath(binaryName); err != nil {
printErrorln("'%s' must exist on your PATH", binaryName)
return subcommands.ExitFailure
}
dockerConfig, err := cliconfig.Load("")
if err != nil {
printErrorln("Unable to load docker config: %v", err)
return subcommands.ExitFailure
}
// 'credsStore' and 'credHelpers' take the suffix of the credential helper
// binary.
credHelperSuffix := binaryName[len(credHelperPrefix):]
return c.setConfig(dockerConfig, credHelperSuffix)
}
// Configure Docker to use the credential helper for GCR's registries only.
// Defining additional 'auths' entries is unnecessary in versions which
// support registry-specific credential helpers.
func (c *dockerConfigCmd) setConfig(dockerConfig *configfile.ConfigFile, helperSuffix string) subcommands.ExitStatus {
// We always overwrite since there's no way that we can accidentally
// disable other credentials as a registry-specific credential helper.
if dockerConfig.CredentialHelpers == nil {
dockerConfig.CredentialHelpers = map[string]string{}
}
var registries []string
if c.registries == "" {
fmt.Println("Configuring default registries....")
fmt.Println("WARNING: A long list of credential helpers may cause delays running 'docker build'.")
fmt.Println("We recommend passing the registry names via the --registries flag for the specific registries you are using")
if c.includeArtifactRegistry {
fmt.Println("Adding config for all GCR and AR registries.")
registries = append(config.DefaultGCRRegistries[:], config.DefaultARRegistries[:]...)
} else {
fmt.Println("Adding config for all GCR registries.")
registries = config.DefaultGCRRegistries[:]
}
} else {
fmt.Println("Configuring supplied registries....")
strReader := strings.NewReader(c.registries)
var err error
registries, err = csv.NewReader(strReader).Read()
if err != nil {
printErrorln("Unable to parse `--registries` value %q: %v", c.registries, err)
return subcommands.ExitFailure
}
fmt.Printf("Adding config for registries: %s\n", strings.Join(registries, ","))
}
for _, registry := range registries {
dockerConfig.CredentialHelpers[strings.TrimSpace(registry)] = helperSuffix
}
if err := dockerConfig.Save(); err != nil {
printErrorln("Unable to save docker config: %v", err)
return subcommands.ExitFailure
}
if c.includeArtifactRegistry {
fmt.Printf("%s configured to use this credential helper for GCR and AR registries\n", dockerConfig.Filename)
} else {
fmt.Printf("%s configured to use this credential helper for GCR registries\n", dockerConfig.Filename)
}
return subcommands.ExitSuccess
}
func printErrorln(fmtString string, v ...interface{}) {
fmt.Fprintf(os.Stderr, "ERROR: "+fmtString+"\n", v...)
}

View File

@ -0,0 +1,92 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
import (
"context"
"flag"
"fmt"
"os"
"github.com/GoogleCloudPlatform/docker-credential-gcr/config"
"github.com/GoogleCloudPlatform/docker-credential-gcr/credhelper"
"github.com/GoogleCloudPlatform/docker-credential-gcr/store"
"github.com/docker/docker-credential-helpers/credentials"
"github.com/google/subcommands"
)
type helperCmd struct {
cmd
}
func (*helperCmd) Execute(context.Context, *flag.FlagSet, ...interface{}) subcommands.ExitStatus {
store, err := store.DefaultGCRCredStore()
if err != nil {
fmt.Fprintf(os.Stderr, "Failure: %v\n", err)
return subcommands.ExitFailure
}
userCfg, err := config.LoadUserConfig()
if err != nil {
fmt.Fprintf(os.Stderr, "Failure: %v\n", err)
return subcommands.ExitFailure
}
credentials.Serve(credhelper.NewGCRCredentialHelper(store, userCfg))
return subcommands.ExitSuccess
}
// NewStoreSubcommand returns a subcommands.Command which implements the Docker
// credential store 'store' API.
func NewStoreSubcommand() subcommands.Command {
return &helperCmd{
cmd{
name: "store",
synopsis: "(UNIMPLEMENTED) for the specified server, store the credentials provided via stdin",
},
}
}
// NewGetSubcommand returns a subcommands.Command which implements the Docker
// credential store 'get' API.
func NewGetSubcommand() subcommands.Command {
return &helperCmd{
cmd{
name: "get",
synopsis: "for the server specified via stdin, return the stored credentials via stdout",
},
}
}
// NewEraseSubcommand returns a subcommands.Command which implements the Docker
// credential store 'erase' API.
func NewEraseSubcommand() subcommands.Command {
return &helperCmd{
cmd{
name: "erase",
synopsis: "(UNIMPLEMENTED) erase any stored credentials for the server specified via stdin",
},
}
}
// NewListSubcommand returns a subcommands.Command which implements the Docker
// credential store 'list' API.
func NewListSubcommand() subcommands.Command {
return &helperCmd{
cmd{
name: "list",
synopsis: "(UNIMPLEMENTED) list all stored credentials",
},
}
}

View File

@ -0,0 +1,70 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
import (
"context"
"flag"
"fmt"
"os"
"github.com/GoogleCloudPlatform/docker-credential-gcr/auth"
"github.com/GoogleCloudPlatform/docker-credential-gcr/store"
"github.com/google/subcommands"
)
type loginCmd struct {
cmd
}
// NewGCRLoginSubcommand returns a subcommands.Command which implements the GCR
// login operation.
func NewGCRLoginSubcommand() subcommands.Command {
return &loginCmd{
cmd{
name: "gcr-login",
synopsis: "log in to GCR",
},
}
}
func (c *loginCmd) Execute(context.Context, *flag.FlagSet, ...interface{}) subcommands.ExitStatus {
if err := c.GCRLogin(); err != nil {
fmt.Fprintf(os.Stderr, "Login failure: %v\n", err)
return subcommands.ExitFailure
}
return subcommands.ExitSuccess
}
// GCRLogin performs the actions necessary to generate a GCR access token
// and persist it for later use.
func (c *loginCmd) GCRLogin() error {
loginAgent := &auth.GCRLoginAgent{}
s, err := store.DefaultGCRCredStore()
if err != nil {
return err
}
tok, err := loginAgent.PerformLogin()
if err != nil {
return fmt.Errorf("unable to authenticate user: %v", err)
}
if err = s.SetGCRAuth(tok); err != nil {
return fmt.Errorf("unable to persist access token: %v", err)
}
return nil
}

View File

@ -0,0 +1,58 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
import (
"context"
"flag"
"fmt"
"os"
"github.com/GoogleCloudPlatform/docker-credential-gcr/store"
"github.com/google/subcommands"
)
type logoutCmd struct {
cmd
}
// NewGCRLogoutSubcommand returns a subcommands.Command which implements the GCR
// logout operation.
func NewGCRLogoutSubcommand() subcommands.Command {
return &logoutCmd{
cmd{
name: "gcr-logout",
synopsis: "log out from GCR",
},
}
}
func (c *logoutCmd) Execute(context.Context, *flag.FlagSet, ...interface{}) subcommands.ExitStatus {
if err := c.GCRLogout(); err != nil {
fmt.Fprintf(os.Stderr, "Logout failure: %v\n", err)
return subcommands.ExitFailure
}
return subcommands.ExitSuccess
}
// GCRLogout performs the actions necessary to remove any GCR credentials
// from the credential store.
func (*logoutCmd) GCRLogout() error {
s, err := store.DefaultGCRCredStore()
if err != nil {
return err
}
return s.DeleteGCRAuth()
}

View File

@ -0,0 +1,45 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cli
import (
"context"
"flag"
"fmt"
"os"
"github.com/GoogleCloudPlatform/docker-credential-gcr/config"
"github.com/google/subcommands"
)
type versionCmd struct {
cmd
}
// NewVersionSubcommand returns a subcommands.Command which prints the binary
// version to stdout.
func NewVersionSubcommand() subcommands.Command {
return &versionCmd{
cmd{
name: "version",
synopsis: "print the version of the binary to stdout",
},
}
}
func (p *versionCmd) Execute(context.Context, *flag.FlagSet, ...interface{}) subcommands.ExitStatus {
fmt.Fprintf(os.Stdout, "Google Container Registry Docker credential helper %s\n", config.Version)
return subcommands.ExitSuccess
}

View File

@ -0,0 +1,21 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"const.go",
"file.go",
],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr/config",
visibility = ["//visibility:public"],
deps = [
"//util:go_default_library",
"//vendor/golang.org/x/oauth2/google:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["config_file_unit_test.go"],
embed = [":go_default_library"],
)

View File

@ -0,0 +1,127 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package config provides variables used in configuring the behavior of the app.
package config
import (
"context"
"fmt"
"runtime/debug"
"strings"
"golang.org/x/oauth2/google"
)
const (
// GCRCredHelperClientID is the client_id to be used when performing the
// OAuth2 Authorization Code grant flow.
// See https://developers.google.com/identity/protocols/OAuth2InstalledApp
GCRCredHelperClientID = "99426463878-o7n0bshgue20tdpm25q4at0vs2mr4utq.apps.googleusercontent.com"
// GCRCredHelperClientNotSoSecret is the client_secret to be used when
// performing the OAuth2 Authorization Code grant flow.
// See https://developers.google.com/identity/protocols/OAuth2InstalledApp
GCRCredHelperClientNotSoSecret = "HpVi8cnKx8AAkddzaNrSWmS8"
)
// Version can be set via:
// -ldflags="-X 'github.com/GoogleCloudPlatform/docker-credential-gcr/config.Version=$TAG'"
var Version string
func init() {
if Version == "" {
i, ok := debug.ReadBuildInfo()
if !ok {
return
}
Version = i.Main.Version
}
}
// DefaultGCRRegistries contains the list of default registries to authenticate for.
var DefaultGCRRegistries = [...]string{
"gcr.io",
"us.gcr.io",
"eu.gcr.io",
"asia.gcr.io",
"marketplace.gcr.io",
}
// DefaultARRegistries contains the list of default registries for Artifact
// Registry. If the --include-artifact-registry flag is supplied then these
// are added in addition to the GCR Registries.
var DefaultARRegistries = [...]string{
"asia-docker.pkg.dev",
"asia-east1-docker.pkg.dev",
"asia-east2-docker.pkg.dev",
"asia-northeast1-docker.pkg.dev",
"asia-northeast2-docker.pkg.dev",
"asia-northeast3-docker.pkg.dev",
"asia-south1-docker.pkg.dev",
"asia-south2-docker.pkg.dev",
"asia-southeast1-docker.pkg.dev",
"asia-southeast2-docker.pkg.dev",
"australia-southeast1-docker.pkg.dev",
"australia-southeast2-docker.pkg.dev",
"europe-docker.pkg.dev",
"europe-central2-docker.pkg.dev",
"europe-north1-docker.pkg.dev",
"europe-southwest1-docker.pkg.dev",
"europe-west1-docker.pkg.dev",
"europe-west2-docker.pkg.dev",
"europe-west3-docker.pkg.dev",
"europe-west4-docker.pkg.dev",
"europe-west6-docker.pkg.dev",
"europe-west8-docker.pkg.dev",
"europe-west9-docker.pkg.dev",
"europe-west12-docker.pkg.dev",
"me-central1-docker.pkg.dev",
"me-west1-docker.pkg.dev",
"northamerica-northeast1-docker.pkg.dev",
"northamerica-northeast2-docker.pkg.dev",
"southamerica-east1-docker.pkg.dev",
"southamerica-west1-docker.pkg.dev",
"us-docker.pkg.dev",
"us-central1-docker.pkg.dev",
"us-east1-docker.pkg.dev",
"us-east4-docker.pkg.dev",
"us-east5-docker.pkg.dev",
"us-south1-docker.pkg.dev",
"us-west1-docker.pkg.dev",
"us-west2-docker.pkg.dev",
"us-west3-docker.pkg.dev",
"us-west4-docker.pkg.dev",
}
// SupportedGCRTokenSources maps config keys to plain english explanations for
// where the helper should search for a GCR access token.
var SupportedGCRTokenSources = map[string]string{
"env": "Application default credentials or GCE/AppEngine metadata.",
"gcloud": "'gcloud auth print-access-token'",
"store": "The file store maintained by the credential helper.",
}
// GCROAuth2Endpoint describes the oauth2.Endpoint to be used when
// authenticating a GCR user.
var GCROAuth2Endpoint = google.Endpoint
// GCRScopes is/are the OAuth2 scope(s) to request during access_token creation.
var GCRScopes = []string{"https://www.googleapis.com/auth/devstorage.read_write"}
// OAuthHTTPContext is the HTTP context to use when performing OAuth2 calls.
var OAuthHTTPContext = context.Background()
// GcrOAuth2Username is the Basic auth username accompanying Docker requests to GCR.
var GcrOAuth2Username = fmt.Sprintf("_dcgcr_%s_token", strings.ReplaceAll(Version, ".", "_"))

View File

@ -0,0 +1,190 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/GoogleCloudPlatform/docker-credential-gcr/util"
)
const (
configFileEnvVariable = "DOCKER_CREDENTIAL_GCR_CONFIG"
configFileName = "docker_credential_gcr_config.json"
)
// DefaultTokenSources designates which default source(s) should be used to
// fetch a GCR access_token, and in which order.
var DefaultTokenSources = [...]string{"store", "env"}
// UserConfig describes
type UserConfig interface {
TokenSources() []string
SetTokenSources([]string) error
ResetAll() error
}
// configFile describes the structure of the persistent config store.
type configFile struct {
TokenSrcs []string `json:"TokenSources,omitempty"`
// package private helper, made a member variable and exposed for testing
persist func(*configFile) error
}
// LoadUserConfig returns the UserConfig which provides user-configurable
// application settings, or a new on if it doesn't exist.
func LoadUserConfig() (UserConfig, error) {
config, err := load()
if err != nil {
if !os.IsNotExist(err) {
return nil, err
}
config = &configFile{}
}
config.persist = persist
return config, nil
}
func load() (*configFile, error) {
path, err := configPath()
if err != nil {
return nil, err
}
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
var config configFile
if err := json.NewDecoder(f).Decode(&config); err != nil {
return nil, fmt.Errorf("failed to load config from %s: %v", path, err)
}
return &config, nil
}
// TokenSources returns the configured token sources, or the DefaultTokenSources
// if none are set.
func (c *configFile) TokenSources() []string {
if len(c.TokenSrcs) == 0 { // if nil or empty
return DefaultTokenSources[:]
}
ret := make([]string, len(c.TokenSrcs))
copy(ret, c.TokenSrcs)
return ret
}
// SetTokenSources sets (and persists) the token sources. Valid token sources
// are defined by config.SupportedGCRTokenSources.
func (c *configFile) SetTokenSources(newSources []string) error {
if len(newSources) == 0 {
newSources = nil
}
// Don't touch the file unless we need to.
if equal(newSources, c.TokenSrcs) {
return nil
}
for _, source := range newSources {
if _, supported := SupportedGCRTokenSources[source]; !supported {
return fmt.Errorf("Unsupported token source: %s", source)
}
}
c.TokenSrcs = newSources
return c.persist(c)
}
func persist(c *configFile) error {
f, err := createConfigFile()
if err != nil {
return err
}
defer f.Close()
return json.NewEncoder(f).Encode(c)
}
func equal(a, b []string) bool {
if a == nil && b == nil {
return true
}
if a == nil || b == nil {
return false
}
if len(a) != len(b) {
return false
}
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
}
// ResetAll clears all user configuration.
func (c *configFile) ResetAll() error {
err := deleteConfigFile()
if err != nil {
return err
}
c.TokenSrcs = nil
return nil
}
func deleteConfigFile() error {
path, err := configPath()
if err != nil && !os.IsNotExist(err) {
return err
}
return os.Remove(path)
}
// createConfigFile creates (or truncates) and returns an os.File for the
// user config.
func createConfigFile() (*os.File, error) {
path, err := configPath()
if err != nil {
return nil, err
}
// create the gcloud config dir, if it doesnt exist
if err = os.MkdirAll(filepath.Dir(path), 0777); err != nil {
return nil, err
}
// create or truncate the config file and return it
return os.Create(path)
}
// configPath returns the full path of our user config file.
func configPath() (string, error) {
if path := os.Getenv(configFileEnvVariable); strings.TrimSpace(path) != "" {
return path, nil
}
sdkConfigPath, err := util.SdkConfigPath()
if err != nil {
return "", fmt.Errorf("couldn't construct config path: %v", err)
}
return filepath.Join(sdkConfigPath, configFileName), nil
}

View File

@ -0,0 +1,30 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["helper.go"],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr/credhelper",
visibility = ["//visibility:public"],
deps = [
"//config:go_default_library",
"//store:go_default_library",
"//util/cmd:go_default_library",
"//vendor/github.com/docker/docker-credential-helpers/credentials:go_default_library",
"//vendor/golang.org/x/oauth2/google:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["helper_unit_test.go"],
embed = [":go_default_library"],
deps = [
"//config:go_default_library",
"//mock/mock_cmd:go_default_library",
"//mock/mock_config:go_default_library",
"//mock/mock_store:go_default_library",
"//store:go_default_library",
"//util/cmd:go_default_library",
"//vendor/github.com/golang/mock/gomock:go_default_library",
],
)

View File

@ -0,0 +1,196 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package credhelper implements a Docker credential helper with special facilities
for GCR authentication.
*/
package credhelper
import (
"errors"
"fmt"
"strings"
"github.com/GoogleCloudPlatform/docker-credential-gcr/config"
"github.com/GoogleCloudPlatform/docker-credential-gcr/store"
"github.com/GoogleCloudPlatform/docker-credential-gcr/util/cmd"
"github.com/docker/docker-credential-helpers/credentials"
"golang.org/x/oauth2/google"
)
// gcrCredHelper implements a credentials.Helper interface backed by a GCR
// credential store.
type gcrCredHelper struct {
store store.GCRCredStore
userCfg config.UserConfig
// helper methods, package exposed for testing
envToken func() (string, error)
gcloudSDKToken func(cmd.Command) (string, error)
credStoreToken func(store.GCRCredStore) (string, error)
// `gcloud` exec interface, package exposed for testing
gcloudCmd cmd.Command
}
// NewGCRCredentialHelper returns a Docker credential helper which
// specializes in GCR's authentication schemes.
func NewGCRCredentialHelper(store store.GCRCredStore, userCfg config.UserConfig) credentials.Helper {
return &gcrCredHelper{
store: store,
userCfg: userCfg,
credStoreToken: tokenFromPrivateStore,
gcloudSDKToken: tokenFromGcloudSDK,
envToken: tokenFromEnv,
gcloudCmd: &cmd.RealImpl{Command: "gcloud"},
}
}
// Delete lists all stored credentials and associated usernames.
func (*gcrCredHelper) List() (map[string]string, error) {
return nil, errors.New("list is unimplemented")
}
// Add adds new third-party credentials to the keychain.
func (*gcrCredHelper) Add(*credentials.Credentials) error {
return errors.New("add is unimplemented")
}
// Delete removes third-party credentials from the store.
func (*gcrCredHelper) Delete(string) error {
return errors.New("delete is unimplemented")
}
// Get returns the username and secret to use for a given registry server URL.
func (ch *gcrCredHelper) Get(serverURL string) (string, string, error) {
return ch.gcrCreds()
}
func (ch *gcrCredHelper) gcrCreds() (string, string, error) {
accessToken, err := ch.getGCRAccessToken()
if err != nil {
return "", "", helperErr("could not retrieve GCR's access token", err)
}
return config.GcrOAuth2Username, accessToken, nil
}
// getGCRAccessToken attempts to retrieve a GCR access token from the sources
// listed by ch.tokenSources, in order.
func (ch *gcrCredHelper) getGCRAccessToken() (string, error) {
var token string
var err error
tokenSources := ch.userCfg.TokenSources()
for _, source := range tokenSources {
switch source {
case "env":
token, err = ch.envToken()
case "gcloud", "gcloud_sdk": // gcloud_sdk supported for legacy reasons
token, err = ch.gcloudSDKToken(ch.gcloudCmd)
case "store":
token, err = ch.credStoreToken(ch.store)
default:
return "", helperErr("unknown token source: "+source, nil)
}
// if we successfully retrieved a token, break.
if err == nil {
break
}
}
return token, err
}
/*
tokenFromEnv retrieves a gcloud access_token from the environment.
From https://godoc.org/golang.org/x/oauth2/google:
DefaultTokenSource is a token source that uses "Application Default Credentials".
It looks for credentials in the following places, preferring the first location found:
1. A JSON file whose path is specified by the
GOOGLE_APPLICATION_CREDENTIALS environment variable.
2. A JSON file in a location known to the gcloud command-line tool.
On Windows, this is %APPDATA%/gcloud/application_default_credentials.json.
On other systems, $HOME/.config/gcloud/application_default_credentials.json.
3. On Google App Engine it uses the appengine.AccessToken function.
4. On Google Compute Engine and Google App Engine Managed VMs, it fetches
credentials from the metadata server.
(In this final case any provided scopes are ignored.)
*/
func tokenFromEnv() (string, error) {
ts, err := google.DefaultTokenSource(config.OAuthHTTPContext, config.GCRScopes...)
if err != nil {
return "", err
}
token, err := ts.Token()
if err != nil {
return "", err
}
if !token.Valid() {
return "", helperErr("token was invalid", nil)
}
if token.Type() != "Bearer" {
return "", helperErr(fmt.Sprintf("expected token type \"Bearer\" but got \"%s\"", token.Type()), nil)
}
return token.AccessToken, nil
}
// tokenFromGcloudSDK attempts to generate an access_token using the gcloud SDK.
func tokenFromGcloudSDK(gcloudCmd cmd.Command) (string, error) {
// shelling out to gcloud is the only currently supported way of
// obtaining the gcloud access_token
stdout, err := gcloudCmd.Exec("config", "config-helper", "--force-auth-refresh", "--format=value(credential.access_token)")
if err != nil {
return "", helperErr("`gcloud config config-helper` failed", err)
}
token := strings.TrimSpace(string(stdout))
if token == "" {
return "", helperErr("`gcloud config config-helper` returned an empty access_token", nil)
}
return token, nil
}
func tokenFromPrivateStore(store store.GCRCredStore) (string, error) {
gcrAuth, err := store.GetGCRAuth()
if err != nil {
return "", err
}
ts := gcrAuth.TokenSource(config.OAuthHTTPContext)
tok, err := ts.Token()
if err != nil {
return "", err
}
if !tok.Valid() {
return "", helperErr("token was invalid", nil)
}
return tok.AccessToken, nil
}
func helperErr(message string, err error) error {
if err == nil {
return fmt.Errorf("docker-credential-gcr/helper: %s", message)
}
return fmt.Errorf("docker-credential-gcr/helper: %s: %v", message, err)
}

View File

@ -0,0 +1,55 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Program docker-credential-gcr implements the Docker credential helper API
and allows for more advanced login/authentication schemes for GCR customers.
See README.md
*/
package main
import (
"context"
"flag"
"os"
"github.com/GoogleCloudPlatform/docker-credential-gcr/cli"
"github.com/google/subcommands"
)
const (
gcrGroup = "GCR authentication"
dockerCredStoreGroup = "Docker credential store API"
configGroup = "Config"
)
func main() {
subcommands.Register(subcommands.HelpCommand(), "")
subcommands.Register(subcommands.CommandsCommand(), "")
subcommands.Register(cli.NewStoreSubcommand(), dockerCredStoreGroup)
subcommands.Register(cli.NewGetSubcommand(), dockerCredStoreGroup)
subcommands.Register(cli.NewEraseSubcommand(), dockerCredStoreGroup)
subcommands.Register(cli.NewListSubcommand(), dockerCredStoreGroup)
subcommands.Register(cli.NewGCRLoginSubcommand(), gcrGroup)
subcommands.Register(cli.NewGCRLogoutSubcommand(), gcrGroup)
subcommands.Register(cli.NewDockerConfigSubcommand(), configGroup)
subcommands.Register(cli.NewConfigSubcommand(), configGroup)
subcommands.Register(cli.NewVersionSubcommand(), "")
subcommands.Register(cli.NewClearSubcommand(), "")
flag.Parse()
ctx := context.Background()
os.Exit(int(subcommands.Execute(ctx)))
}

View File

@ -0,0 +1,28 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["store.go"],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr/store",
visibility = ["//visibility:public"],
deps = [
"//config:go_default_library",
"//util:go_default_library",
"//vendor/github.com/docker/docker-credential-helpers/credentials:go_default_library",
"//vendor/golang.org/x/oauth2:go_default_library",
"//vendor/golang.org/x/oauth2/google:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = [
"store_integration_test.go",
"store_unit_test.go",
],
embed = [":go_default_library"],
deps = [
"//vendor/github.com/docker/docker-credential-helpers/credentials:go_default_library",
"//vendor/golang.org/x/oauth2:go_default_library",
],
)

View File

@ -0,0 +1,227 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package store implements a credential store that is capable of storing both
plain Docker credentials as well as GCR access and refresh tokens.
*/
package store
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"github.com/GoogleCloudPlatform/docker-credential-gcr/config"
"github.com/GoogleCloudPlatform/docker-credential-gcr/util"
"github.com/docker/docker-credential-helpers/credentials"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
)
const (
credentialStoreEnvVar = "DOCKER_CREDENTIAL_GCR_STORE"
credentialStoreFilename = "docker_credentials.json"
)
type tokens struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenExpiry *time.Time `json:"token_expiry"`
}
type dockerCredentials struct {
GCRCreds *tokens `json:"gcrCreds,omitempty"`
}
// A GCRAuth provides access to tokens from a prior login.
type GCRAuth struct {
conf *oauth2.Config
initialToken *oauth2.Token
}
// TokenSource returns an oauth2.TokenSource that retrieve tokens from
// GCR credentials using the provided context.
// It will returns the current access token stored in the credentials,
// and refresh it when it expires, but it won't update the credentials
// with the new access token.
func (a *GCRAuth) TokenSource(ctx context.Context) oauth2.TokenSource {
return a.conf.TokenSource(ctx, a.initialToken)
}
// GCRCredStore describes the interface for a store capable of storing both
// GCR's credentials (OAuth2 access/refresh tokens) as well as generic
// Docker credentials.
type GCRCredStore interface {
GetGCRAuth() (*GCRAuth, error)
SetGCRAuth(tok *oauth2.Token) error
DeleteGCRAuth() error
}
type credStore struct {
credentialPath string
}
// DefaultGCRCredStore returns a GCRCredStore which is backed by a file.
func DefaultGCRCredStore() (GCRCredStore, error) {
path, err := dockerCredentialPath()
return &credStore{
credentialPath: path,
}, err
}
// NewGCRCredStore returns a GCRCredStore which is backed by the given file.
func NewGCRCredStore(path string) GCRCredStore {
return &credStore{
credentialPath: path,
}
}
// GetGCRAuth creates an GCRAuth for the currently signed-in account.
func (s *credStore) GetGCRAuth() (*GCRAuth, error) {
creds, err := s.loadDockerCredentials()
if err != nil {
if os.IsNotExist(err) {
// No file, no credentials.
return nil, credentials.NewErrCredentialsNotFound()
}
return nil, err
}
if creds.GCRCreds == nil {
return nil, errors.New("GCR Credentials not present in store")
}
var expiry time.Time
if creds.GCRCreds.TokenExpiry != nil {
expiry = *creds.GCRCreds.TokenExpiry
}
return &GCRAuth{
conf: &oauth2.Config{
ClientID: config.GCRCredHelperClientID,
ClientSecret: config.GCRCredHelperClientNotSoSecret,
Scopes: config.GCRScopes,
Endpoint: google.Endpoint,
RedirectURL: "oob",
},
initialToken: &oauth2.Token{
AccessToken: creds.GCRCreds.AccessToken,
RefreshToken: creds.GCRCreds.RefreshToken,
Expiry: expiry,
},
}, nil
}
// SetGCRAuth sets the stored GCR credentials.
func (s *credStore) SetGCRAuth(tok *oauth2.Token) error {
creds, err := s.loadDockerCredentials()
if err != nil {
// It's OK if we couldn't read any credentials,
// making a new file.
creds = &dockerCredentials{}
}
creds.GCRCreds = &tokens{
AccessToken: tok.AccessToken,
RefreshToken: tok.RefreshToken,
TokenExpiry: &tok.Expiry,
}
return s.setDockerCredentials(creds)
}
// DeleteGCRAuth deletes the stored GCR credentials.
func (s *credStore) DeleteGCRAuth() error {
creds, err := s.loadDockerCredentials()
if err != nil {
if os.IsNotExist(err) {
// No file, no credentials.
return nil
}
return err
}
// Optimization: only perform a 'set' if necessary
if creds.GCRCreds != nil {
creds.GCRCreds = nil
return s.setDockerCredentials(creds)
}
return nil
}
func (s *credStore) createCredentialFile() (*os.File, error) {
// create the gcloud config dir, if it doesnt exist
if err := os.MkdirAll(filepath.Dir(s.credentialPath), 0777); err != nil {
return nil, err
}
// create the credential file, or truncate (clear) it if it exists
f, err := os.Create(s.credentialPath)
os.Chmod(s.credentialPath, 0600)
if err != nil {
return nil, authErr("failed to create credential file", err)
}
return f, nil
}
func (s *credStore) loadDockerCredentials() (*dockerCredentials, error) {
path := s.credentialPath
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
var creds dockerCredentials
if err := json.NewDecoder(f).Decode(&creds); err != nil {
return nil, authErr("failed to decode credentials from "+path, err)
}
return &creds, nil
}
func (s *credStore) setDockerCredentials(creds *dockerCredentials) error {
f, err := s.createCredentialFile()
if err != nil {
return err
}
defer f.Close()
return json.NewEncoder(f).Encode(creds)
}
// dockerCredentialPath returns the full path of our Docker credential store.
func dockerCredentialPath() (string, error) {
if path := os.Getenv(credentialStoreEnvVar); strings.TrimSpace(path) != "" {
return path, nil
}
configPath, err := util.SdkConfigPath()
if err != nil {
return "", authErr("couldn't construct config path", err)
}
return filepath.Join(configPath, credentialStoreFilename), nil
}
func authErr(message string, err error) error {
if err == nil {
return fmt.Errorf("docker-credential-gcr/store: %s", message)
}
return fmt.Errorf("docker-credential-gcr/store: %s: %v", message, err)
}

View File

@ -0,0 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["util.go"],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr/util",
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,8 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["exec.go"],
importpath = "github.com/GoogleCloudPlatform/docker-credential-gcr/util/cmd",
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,41 @@
// Copyright 2017 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package cmd contains utilities to execute commands using a test-friendly
interface.
*/
package cmd
import (
"os/exec"
)
// Command execs a command with the given arguments.
type Command interface {
Exec(...string) ([]byte, error)
}
// RealImpl is a real implementation of Command which uses exec.Command to
// execute the given cmd.
type RealImpl struct {
// The command to execute.
Command string
}
// Exec executes the defined command with the given args, returning the results
// of stdout, or an error.
func (s *RealImpl) Exec(args ...string) ([]byte, error) {
return exec.Command(s.Command, args...).Output()
}

View File

@ -0,0 +1,53 @@
// Copyright 2016 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package util contains utilities which are shared between packages.
*/
package util
import (
"errors"
"os"
"os/user"
"path/filepath"
"runtime"
)
// SdkConfigPath tries to return the directory where the gcloud config is
// located.
func SdkConfigPath() (string, error) {
if runtime.GOOS == "windows" {
return filepath.Join(os.Getenv("APPDATA"), "gcloud"), nil
}
homeDir := unixHomeDir()
if homeDir == "" {
return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty")
}
return filepath.Join(homeDir, ".config", "gcloud"), nil
}
// unixHomeDir returns the user's home directory. Note that $HOME has
// precedence over records in the password database since the credential helper
// may be running under a different UID in a user namespace.
func unixHomeDir() string {
homeDir := os.Getenv("HOME")
if homeDir != "" {
return homeDir
}
if usr, err := user.Current(); err == nil {
return usr.HomeDir
}
return ""
}

View File

@ -1,3 +1,158 @@
# v1.18.10 (2023-04-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.18.9 (2023-04-10)
* No change notes available for this release.
# v1.18.8 (2023-04-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.18.7 (2023-03-21)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.18.6 (2023-03-10)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.18.5 (2023-02-22)
* **Bug Fix**: Prevent nil pointer dereference when retrieving error codes.
# v1.18.4 (2023-02-20)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.18.3 (2023-02-15)
* **Announcement**: When receiving an error response in restJson-based services, an incorrect error type may have been returned based on the content of the response. This has been fixed via PR #2012 tracked in issue #1910.
* **Bug Fix**: Correct error type parsing for restJson services.
# v1.18.2 (2023-02-03)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.18.1 (2023-01-23)
* No change notes available for this release.
# v1.18.0 (2023-01-05)
* **Feature**: Add `ErrorCodeOverride` field to all error structs (aws/smithy-go#401).
# v1.17.25 (2022-12-15)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.24 (2022-12-02)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.23 (2022-11-22)
* No change notes available for this release.
# v1.17.22 (2022-11-16)
* No change notes available for this release.
# v1.17.21 (2022-11-10)
* No change notes available for this release.
# v1.17.20 (2022-10-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.19 (2022-10-21)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.18 (2022-09-20)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.17 (2022-09-14)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.16 (2022-09-02)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.15 (2022-08-31)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.14 (2022-08-30)
* No change notes available for this release.
# v1.17.13 (2022-08-29)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.12 (2022-08-11)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.11 (2022-08-09)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.10 (2022-08-08)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.9 (2022-08-01)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.8 (2022-07-05)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.7 (2022-06-29)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.6 (2022-06-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.5 (2022-05-17)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.4 (2022-04-25)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.3 (2022-03-30)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.2 (2022-03-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.1 (2022-03-23)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.0 (2022-03-21)
* **Feature**: This release includes a fix in the DescribeImageScanFindings paginated output.
# v1.16.0 (2022-03-08)
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
* **Feature**: Updated service client model to latest release.
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.0 (2022-02-24)
* **Feature**: API client updated

View File

@ -115,7 +115,7 @@ type Options struct {
Retryer aws.Retryer
// The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig. You
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You
// should not populate this structure programmatically, or rely on the values here
// within your applications.
RuntimeEnvironment aws.RuntimeEnvironment

View File

@ -57,8 +57,8 @@ type BatchCheckLayerAvailabilityOutput struct {
// Any failures associated with the call.
Failures []types.LayerFailure
// A list of image layer objects corresponding to the image layer references in the
// request.
// A list of image layer objects corresponding to the image layer references in
// the request.
Layers []types.Layer
// Metadata pertaining to the operation's result.
@ -118,6 +118,9 @@ func (c *Client) addOperationBatchCheckLayerAvailabilityMiddlewares(stack *middl
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchCheckLayerAvailability(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -12,7 +12,7 @@ import (
)
// Deletes a list of specified images within a repository. Images are specified
// with either an imageTag or imageDigest. You can remove a tag from an image by
// with either an imageTag or imageDigest . You can remove a tag from an image by
// specifying the image's tag in your request. When you remove the last tag from an
// image, the image is deleted from your repository. You can completely delete an
// image (and all of its tags) by specifying the image's digest in your request.
@ -32,11 +32,11 @@ func (c *Client) BatchDeleteImage(ctx context.Context, params *BatchDeleteImageI
}
// Deletes specified images within a specified repository. Images are specified
// with either the imageTag or imageDigest.
// with either the imageTag or imageDigest .
type BatchDeleteImageInput struct {
// A list of image ID references that correspond to images to delete. The format of
// the imageIds reference is imageTag=tag or imageDigest=digest.
// A list of image ID references that correspond to images to delete. The format
// of the imageIds reference is imageTag=tag or imageDigest=digest .
//
// This member is required.
ImageIds []types.ImageIdentifier
@ -119,6 +119,9 @@ func (c *Client) addOperationBatchDeleteImageMiddlewares(stack *middleware.Stack
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchDeleteImage(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -12,7 +12,7 @@ import (
)
// Gets detailed information for an image. Images are specified with either an
// imageTag or imageDigest. When an image is pulled, the BatchGetImage API is
// imageTag or imageDigest . When an image is pulled, the BatchGetImage API is
// called once to retrieve the image manifest.
func (c *Client) BatchGetImage(ctx context.Context, params *BatchGetImageInput, optFns ...func(*Options)) (*BatchGetImageOutput, error) {
if params == nil {
@ -32,7 +32,7 @@ func (c *Client) BatchGetImage(ctx context.Context, params *BatchGetImageInput,
type BatchGetImageInput struct {
// A list of image ID references that correspond to images to describe. The format
// of the imageIds reference is imageTag=tag or imageDigest=digest.
// of the imageIds reference is imageTag=tag or imageDigest=digest .
//
// This member is required.
ImageIds []types.ImageIdentifier
@ -121,6 +121,9 @@ func (c *Client) addOperationBatchGetImageMiddlewares(stack *middleware.Stack, o
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchGetImage(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -102,6 +102,9 @@ func (c *Client) addOperationBatchGetRepositoryScanningConfigurationMiddlewares(
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchGetRepositoryScanningConfiguration(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -129,6 +129,9 @@ func (c *Client) addOperationCompleteLayerUploadMiddlewares(stack *middleware.St
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCompleteLayerUpload(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -122,6 +122,9 @@ func (c *Client) addOperationCreatePullThroughCacheRuleMiddlewares(stack *middle
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreatePullThroughCacheRule(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,9 +11,8 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a repository. For more information, see Amazon ECR repositories
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html) in
// the Amazon Elastic Container Registry User Guide.
// Creates a repository. For more information, see Amazon ECR repositories (https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html)
// in the Amazon Elastic Container Registry User Guide.
func (c *Client) CreateRepository(ctx context.Context, params *CreateRepositoryInput, optFns ...func(*Options)) (*CreateRepositoryOutput, error) {
if params == nil {
params = &CreateRepositoryInput{}
@ -32,8 +31,8 @@ func (c *Client) CreateRepository(ctx context.Context, params *CreateRepositoryI
type CreateRepositoryInput struct {
// The name to use for the repository. The repository name may be specified on its
// own (such as nginx-web-app) or it can be prepended with a namespace to group the
// repository into a category (such as project-a/nginx-web-app).
// own (such as nginx-web-app ) or it can be prepended with a namespace to group
// the repository into a category (such as project-a/nginx-web-app ).
//
// This member is required.
RepositoryName *string
@ -47,8 +46,8 @@ type CreateRepositoryInput struct {
// repository.
ImageScanningConfiguration *types.ImageScanningConfiguration
// The tag mutability setting for the repository. If this parameter is omitted, the
// default setting of MUTABLE will be used which will allow image tags to be
// The tag mutability setting for the repository. If this parameter is omitted,
// the default setting of MUTABLE will be used which will allow image tags to be
// overwritten. If IMMUTABLE is specified, all image tags within the repository
// will be immutable which will prevent them from being overwritten.
ImageTagMutability types.ImageTagMutability
@ -128,6 +127,9 @@ func (c *Client) addOperationCreateRepositoryMiddlewares(stack *middleware.Stack
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateRepository(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -113,6 +113,9 @@ func (c *Client) addOperationDeleteLifecyclePolicyMiddlewares(stack *middleware.
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteLifecyclePolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -114,6 +114,9 @@ func (c *Client) addOperationDeletePullThroughCacheRuleMiddlewares(stack *middle
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeletePullThroughCacheRule(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -92,6 +92,9 @@ func (c *Client) addOperationDeleteRegistryPolicyMiddlewares(stack *middleware.S
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRegistryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -108,6 +108,9 @@ func (c *Client) addOperationDeleteRepositoryMiddlewares(stack *middleware.Stack
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRepository(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -110,6 +110,9 @@ func (c *Client) addOperationDeleteRepositoryPolicyMiddlewares(stack *middleware
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRepositoryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -114,6 +114,9 @@ func (c *Client) addOperationDescribeImageReplicationStatusMiddlewares(stack *mi
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeImageReplicationStatus(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -45,11 +45,11 @@ type DescribeImageScanFindingsInput struct {
RepositoryName *string
// The maximum number of image scan results returned by DescribeImageScanFindings
// in paginated output. When this parameter is used, DescribeImageScanFindings only
// returns maxResults results in a single page along with a nextToken response
// element. The remaining results of the initial request can be seen by sending
// another DescribeImageScanFindings request with the returned nextToken value.
// This value can be between 1 and 1000. If this parameter is not used, then
// in paginated output. When this parameter is used, DescribeImageScanFindings
// only returns maxResults results in a single page along with a nextToken
// response element. The remaining results of the initial request can be seen by
// sending another DescribeImageScanFindings request with the returned nextToken
// value. This value can be between 1 and 1000. If this parameter is not used, then
// DescribeImageScanFindings returns up to 100 results and a nextToken value, if
// applicable.
MaxResults *int32
@ -81,7 +81,7 @@ type DescribeImageScanFindingsOutput struct {
ImageScanStatus *types.ImageScanStatus
// The nextToken value to include in a future DescribeImageScanFindings request.
// When the results of a DescribeImageScanFindings request exceed maxResults, this
// When the results of a DescribeImageScanFindings request exceed maxResults , this
// value can be used to retrieve the next page of results. This value is null when
// there are no more results to return.
NextToken *string
@ -149,6 +149,9 @@ func (c *Client) addOperationDescribeImageScanFindingsMiddlewares(stack *middlew
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeImageScanFindings(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -173,11 +176,11 @@ var _ DescribeImageScanFindingsAPIClient = (*Client)(nil)
// DescribeImageScanFindings
type DescribeImageScanFindingsPaginatorOptions struct {
// The maximum number of image scan results returned by DescribeImageScanFindings
// in paginated output. When this parameter is used, DescribeImageScanFindings only
// returns maxResults results in a single page along with a nextToken response
// element. The remaining results of the initial request can be seen by sending
// another DescribeImageScanFindings request with the returned nextToken value.
// This value can be between 1 and 1000. If this parameter is not used, then
// in paginated output. When this parameter is used, DescribeImageScanFindings
// only returns maxResults results in a single page along with a nextToken
// response element. The remaining results of the initial request can be seen by
// sending another DescribeImageScanFindings request with the returned nextToken
// value. This value can be between 1 and 1000. If this parameter is not used, then
// DescribeImageScanFindings returns up to 100 results and a nextToken value, if
// applicable.
Limit int32
@ -273,9 +276,9 @@ type ImageScanCompleteWaiterOptions struct {
// MinDelay must resolve to a value lesser than or equal to the MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or set
// to zero, ImageScanCompleteWaiter will use default max delay of 120 seconds. Note
// that MaxDelay must resolve to value greater than or equal to the MinDelay.
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, ImageScanCompleteWaiter will use default max delay of 120 seconds.
// Note that MaxDelay must resolve to value greater than or equal to the MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts
@ -323,10 +326,10 @@ func (w *ImageScanCompleteWaiter) Wait(ctx context.Context, params *DescribeImag
return err
}
// WaitForOutput calls the waiter function for ImageScanComplete waiter and returns
// the output of the successful operation. The maxWaitDur is the maximum wait
// duration the waiter will wait. The maxWaitDur is required and must be greater
// than zero.
// WaitForOutput calls the waiter function for ImageScanComplete waiter and
// returns the output of the successful operation. The maxWaitDur is the maximum
// wait duration the waiter will wait. The maxWaitDur is required and must be
// greater than zero.
func (w *ImageScanCompleteWaiter) WaitForOutput(ctx context.Context, params *DescribeImageScanFindingsInput, maxWaitDur time.Duration, optFns ...func(*ImageScanCompleteWaiterOptions)) (*DescribeImageScanFindingsOutput, error) {
if maxWaitDur <= 0 {
return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero")

View File

@ -12,11 +12,11 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns metadata about the images in a repository. Beginning with Docker version
// 1.9, the Docker client compresses image layers before pushing them to a V2
// Docker registry. The output of the docker images command shows the uncompressed
// image size, so it may return a larger image size than the image sizes returned
// by DescribeImages.
// Returns metadata about the images in a repository. Beginning with Docker
// version 1.9, the Docker client compresses image layers before pushing them to a
// V2 Docker registry. The output of the docker images command shows the
// uncompressed image size, so it may return a larger image size than the image
// sizes returned by DescribeImages .
func (c *Client) DescribeImages(ctx context.Context, params *DescribeImagesInput, optFns ...func(*Options)) (*DescribeImagesOutput, error) {
if params == nil {
params = &DescribeImagesInput{}
@ -45,21 +45,21 @@ type DescribeImagesInput struct {
// The list of image IDs for the requested repository.
ImageIds []types.ImageIdentifier
// The maximum number of repository results returned by DescribeImages in paginated
// output. When this parameter is used, DescribeImages only returns maxResults
// results in a single page along with a nextToken response element. The remaining
// results of the initial request can be seen by sending another DescribeImages
// request with the returned nextToken value. This value can be between 1 and 1000.
// If this parameter is not used, then DescribeImages returns up to 100 results and
// a nextToken value, if applicable. This option cannot be used when you specify
// images with imageIds.
// The maximum number of repository results returned by DescribeImages in
// paginated output. When this parameter is used, DescribeImages only returns
// maxResults results in a single page along with a nextToken response element.
// The remaining results of the initial request can be seen by sending another
// DescribeImages request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter is not used, then DescribeImages returns
// up to 100 results and a nextToken value, if applicable. This option cannot be
// used when you specify images with imageIds .
MaxResults *int32
// The nextToken value returned from a previous paginated DescribeImages request
// where maxResults was used and the results exceeded the value of that parameter.
// Pagination continues from the end of the previous results that returned the
// nextToken value. This value is null when there are no more results to return.
// This option cannot be used when you specify images with imageIds.
// This option cannot be used when you specify images with imageIds .
NextToken *string
// The Amazon Web Services account ID associated with the registry that contains
@ -76,8 +76,8 @@ type DescribeImagesOutput struct {
ImageDetails []types.ImageDetail
// The nextToken value to include in a future DescribeImages request. When the
// results of a DescribeImages request exceed maxResults, this value can be used to
// retrieve the next page of results. This value is null when there are no more
// results of a DescribeImages request exceed maxResults , this value can be used
// to retrieve the next page of results. This value is null when there are no more
// results to return.
NextToken *string
@ -138,6 +138,9 @@ func (c *Client) addOperationDescribeImagesMiddlewares(stack *middleware.Stack,
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeImages(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -160,14 +163,14 @@ var _ DescribeImagesAPIClient = (*Client)(nil)
// DescribeImagesPaginatorOptions is the paginator options for DescribeImages
type DescribeImagesPaginatorOptions struct {
// The maximum number of repository results returned by DescribeImages in paginated
// output. When this parameter is used, DescribeImages only returns maxResults
// results in a single page along with a nextToken response element. The remaining
// results of the initial request can be seen by sending another DescribeImages
// request with the returned nextToken value. This value can be between 1 and 1000.
// If this parameter is not used, then DescribeImages returns up to 100 results and
// a nextToken value, if applicable. This option cannot be used when you specify
// images with imageIds.
// The maximum number of repository results returned by DescribeImages in
// paginated output. When this parameter is used, DescribeImages only returns
// maxResults results in a single page along with a nextToken response element.
// The remaining results of the initial request can be seen by sending another
// DescribeImages request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter is not used, then DescribeImages returns
// up to 100 results and a nextToken value, if applicable. This option cannot be
// used when you specify images with imageIds .
Limit int32
// Set to true if pagination should stop if the service returns a pagination token

View File

@ -65,7 +65,7 @@ type DescribePullThroughCacheRulesOutput struct {
// The nextToken value to include in a future DescribePullThroughCacheRulesRequest
// request. When the results of a DescribePullThroughCacheRulesRequest request
// exceed maxResults, this value can be used to retrieve the next page of results.
// exceed maxResults , this value can be used to retrieve the next page of results.
// This value is null when there are no more results to return.
NextToken *string
@ -126,6 +126,9 @@ func (c *Client) addOperationDescribePullThroughCacheRulesMiddlewares(stack *mid
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribePullThroughCacheRules(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -95,6 +95,9 @@ func (c *Client) addOperationDescribeRegistryMiddlewares(stack *middleware.Stack
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeRegistry(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -31,13 +31,14 @@ func (c *Client) DescribeRepositories(ctx context.Context, params *DescribeRepos
type DescribeRepositoriesInput struct {
// The maximum number of repository results returned by DescribeRepositories in
// paginated output. When this parameter is used, DescribeRepositories only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeRepositories request with the returned nextToken value. This value can
// be between 1 and 1000. If this parameter is not used, then DescribeRepositories
// returns up to 100 results and a nextToken value, if applicable. This option
// cannot be used when you specify repositories with repositoryNames.
// paginated output. When this parameter is used, DescribeRepositories only
// returns maxResults results in a single page along with a nextToken response
// element. The remaining results of the initial request can be seen by sending
// another DescribeRepositories request with the returned nextToken value. This
// value can be between 1 and 1000. If this parameter is not used, then
// DescribeRepositories returns up to 100 results and a nextToken value, if
// applicable. This option cannot be used when you specify repositories with
// repositoryNames .
MaxResults *int32
// The nextToken value returned from a previous paginated DescribeRepositories
@ -45,7 +46,7 @@ type DescribeRepositoriesInput struct {
// parameter. Pagination continues from the end of the previous results that
// returned the nextToken value. This value is null when there are no more results
// to return. This option cannot be used when you specify repositories with
// repositoryNames. This token should be treated as an opaque identifier that is
// repositoryNames . This token should be treated as an opaque identifier that is
// only used to retrieve the next items in a list and not for other programmatic
// purposes.
NextToken *string
@ -65,7 +66,7 @@ type DescribeRepositoriesInput struct {
type DescribeRepositoriesOutput struct {
// The nextToken value to include in a future DescribeRepositories request. When
// the results of a DescribeRepositories request exceed maxResults, this value can
// the results of a DescribeRepositories request exceed maxResults , this value can
// be used to retrieve the next page of results. This value is null when there are
// no more results to return.
NextToken *string
@ -127,6 +128,9 @@ func (c *Client) addOperationDescribeRepositoriesMiddlewares(stack *middleware.S
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeRepositories(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -151,13 +155,14 @@ var _ DescribeRepositoriesAPIClient = (*Client)(nil)
// DescribeRepositories
type DescribeRepositoriesPaginatorOptions struct {
// The maximum number of repository results returned by DescribeRepositories in
// paginated output. When this parameter is used, DescribeRepositories only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeRepositories request with the returned nextToken value. This value can
// be between 1 and 1000. If this parameter is not used, then DescribeRepositories
// returns up to 100 results and a nextToken value, if applicable. This option
// cannot be used when you specify repositories with repositoryNames.
// paginated output. When this parameter is used, DescribeRepositories only
// returns maxResults results in a single page along with a nextToken response
// element. The remaining results of the initial request can be seen by sending
// another DescribeRepositories request with the returned nextToken value. This
// value can be between 1 and 1000. If this parameter is not used, then
// DescribeRepositories returns up to 100 results and a nextToken value, if
// applicable. This option cannot be used when you specify repositories with
// repositoryNames .
Limit int32
// Set to true if pagination should stop if the service returns a pagination token

View File

@ -17,8 +17,7 @@ import (
// hours. The authorizationToken returned is a base64 encoded string that can be
// decoded and used in a docker login command to authenticate to a registry. The
// CLI offers an get-login-password command that simplifies the login process. For
// more information, see Registry authentication
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html#registry_auth)
// more information, see Registry authentication (https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html#registry_auth)
// in the Amazon Elastic Container Registry User Guide.
func (c *Client) GetAuthorizationToken(ctx context.Context, params *GetAuthorizationTokenInput, optFns ...func(*Options)) (*GetAuthorizationTokenOutput, error) {
if params == nil {
@ -110,6 +109,9 @@ func (c *Client) addOperationGetAuthorizationTokenMiddlewares(stack *middleware.
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAuthorizationToken(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -10,11 +10,11 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer.
// You can only get URLs for image layers that are referenced in an image. When an
// image is pulled, the GetDownloadUrlForLayer API is called once per image layer
// that is not already cached. This operation is used by the Amazon ECR proxy and
// is not generally used by customers for pulling and pushing images. In most
// Retrieves the pre-signed Amazon S3 download URL corresponding to an image
// layer. You can only get URLs for image layers that are referenced in an image.
// When an image is pulled, the GetDownloadUrlForLayer API is called once per image
// layer that is not already cached. This operation is used by the Amazon ECR proxy
// and is not generally used by customers for pulling and pushing images. In most
// cases, you should use the docker CLI to pull, tag, and push images.
func (c *Client) GetDownloadUrlForLayer(ctx context.Context, params *GetDownloadUrlForLayerInput, optFns ...func(*Options)) (*GetDownloadUrlForLayerOutput, error) {
if params == nil {
@ -116,6 +116,9 @@ func (c *Client) addOperationGetDownloadUrlForLayerMiddlewares(stack *middleware
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDownloadUrlForLayer(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -113,6 +113,9 @@ func (c *Client) addOperationGetLifecyclePolicyMiddlewares(stack *middleware.Sta
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLifecyclePolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -50,13 +50,13 @@ type GetLifecyclePolicyPreviewInput struct {
// The maximum number of repository results returned by
// GetLifecyclePolicyPreviewRequest in paginated output. When this parameter is
// used, GetLifecyclePolicyPreviewRequest only returns maxResults results in a
// single page along with a nextToken response element. The remaining results of
// single page along with a nextToken response element. The remaining results of
// the initial request can be seen by sending another
// GetLifecyclePolicyPreviewRequest request with the returned nextToken value.
// GetLifecyclePolicyPreviewRequest request with the returned nextToken value.
// This value can be between 1 and 1000. If this parameter is not used, then
// GetLifecyclePolicyPreviewRequest returns up to 100 results and a nextToken
// value, if applicable. This option cannot be used when you specify images with
// imageIds.
// imageIds .
MaxResults *int32
// The nextToken value returned from a previous paginated
@ -64,7 +64,7 @@ type GetLifecyclePolicyPreviewInput struct {
// results exceeded the value of that parameter. Pagination continues from the end
// of the previous results that returned the nextToken value. This value is null
// when there are no more results to return. This option cannot be used when you
// specify images with imageIds.
// specify images with imageIds .
NextToken *string
// The Amazon Web Services account ID associated with the registry that contains
@ -81,7 +81,7 @@ type GetLifecyclePolicyPreviewOutput struct {
LifecyclePolicyText *string
// The nextToken value to include in a future GetLifecyclePolicyPreview request.
// When the results of a GetLifecyclePolicyPreview request exceed maxResults, this
// When the results of a GetLifecyclePolicyPreview request exceed maxResults , this
// value can be used to retrieve the next page of results. This value is null when
// there are no more results to return.
NextToken *string
@ -158,6 +158,9 @@ func (c *Client) addOperationGetLifecyclePolicyPreviewMiddlewares(stack *middlew
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLifecyclePolicyPreview(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -184,13 +187,13 @@ type GetLifecyclePolicyPreviewPaginatorOptions struct {
// The maximum number of repository results returned by
// GetLifecyclePolicyPreviewRequest in paginated output. When this parameter is
// used, GetLifecyclePolicyPreviewRequest only returns maxResults results in a
// single page along with a nextToken response element. The remaining results of
// single page along with a nextToken response element. The remaining results of
// the initial request can be seen by sending another
// GetLifecyclePolicyPreviewRequest request with the returned nextToken value.
// GetLifecyclePolicyPreviewRequest request with the returned nextToken value.
// This value can be between 1 and 1000. If this parameter is not used, then
// GetLifecyclePolicyPreviewRequest returns up to 100 results and a nextToken
// value, if applicable. This option cannot be used when you specify images with
// imageIds.
// imageIds .
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
@ -286,10 +289,10 @@ type LifecyclePolicyPreviewCompleteWaiterOptions struct {
// MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or set
// to zero, LifecyclePolicyPreviewCompleteWaiter will use default max delay of 120
// seconds. Note that MaxDelay must resolve to value greater than or equal to the
// MinDelay.
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, LifecyclePolicyPreviewCompleteWaiter will use default max delay of
// 120 seconds. Note that MaxDelay must resolve to value greater than or equal to
// the MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts

View File

@ -92,6 +92,9 @@ func (c *Client) addOperationGetRegistryPolicyMiddlewares(stack *middleware.Stac
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRegistryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -93,6 +93,9 @@ func (c *Client) addOperationGetRegistryScanningConfigurationMiddlewares(stack *
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRegistryScanningConfiguration(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -109,6 +109,9 @@ func (c *Client) addOperationGetRepositoryPolicyMiddlewares(stack *middleware.St
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRepositoryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -113,6 +113,9 @@ func (c *Client) addOperationInitiateLayerUploadMiddlewares(stack *middleware.St
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opInitiateLayerUpload(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -14,7 +14,7 @@ import (
// Lists all the image IDs for the specified repository. You can filter images
// based on whether or not they are tagged by using the tagStatus filter and
// specifying either TAGGED, UNTAGGED or ANY. For example, you can filter your
// specifying either TAGGED , UNTAGGED or ANY . For example, you can filter your
// results to return only UNTAGGED images and then pipe that result to a
// BatchDeleteImage operation to delete them. Or, you can filter your results to
// return only TAGGED images to list all of the tags in your repository.
@ -74,7 +74,7 @@ type ListImagesOutput struct {
ImageIds []types.ImageIdentifier
// The nextToken value to include in a future ListImages request. When the results
// of a ListImages request exceed maxResults, this value can be used to retrieve
// of a ListImages request exceed maxResults , this value can be used to retrieve
// the next page of results. This value is null when there are no more results to
// return.
NextToken *string
@ -136,6 +136,9 @@ func (c *Client) addOperationListImagesMiddlewares(stack *middleware.Stack, opti
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListImages(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -100,6 +100,9 @@ func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.St
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,12 +11,12 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates or updates the image manifest and tags associated with an image. When an
// image is pushed and all new image layers have been uploaded, the PutImage API is
// called once to create or update the image manifest and the tags associated with
// the image. This operation is used by the Amazon ECR proxy and is not generally
// used by customers for pulling and pushing images. In most cases, you should use
// the docker CLI to pull, tag, and push images.
// Creates or updates the image manifest and tags associated with an image. When
// an image is pushed and all new image layers have been uploaded, the PutImage API
// is called once to create or update the image manifest and the tags associated
// with the image. This operation is used by the Amazon ECR proxy and is not
// generally used by customers for pulling and pushing images. In most cases, you
// should use the docker CLI to pull, tag, and push images.
func (c *Client) PutImage(ctx context.Context, params *PutImageInput, optFns ...func(*Options)) (*PutImageOutput, error) {
if params == nil {
params = &PutImageInput{}
@ -127,6 +127,9 @@ func (c *Client) addOperationPutImageMiddlewares(stack *middleware.Stack, option
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutImage(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,7 +11,10 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates the image scanning configuration for the specified repository.
// The PutImageScanningConfiguration API is being deprecated, in favor of
// specifying the image scanning configuration at the registry level. For more
// information, see PutRegistryScanningConfiguration . Updates the image scanning
// configuration for the specified repository.
func (c *Client) PutImageScanningConfiguration(ctx context.Context, params *PutImageScanningConfigurationInput, optFns ...func(*Options)) (*PutImageScanningConfigurationOutput, error) {
if params == nil {
params = &PutImageScanningConfigurationInput{}
@ -118,6 +121,9 @@ func (c *Client) addOperationPutImageScanningConfigurationMiddlewares(stack *mid
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutImageScanningConfiguration(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,9 +11,8 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates the image tag mutability settings for the specified repository. For more
// information, see Image tag mutability
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-tag-mutability.html)
// Updates the image tag mutability settings for the specified repository. For
// more information, see Image tag mutability (https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-tag-mutability.html)
// in the Amazon Elastic Container Registry User Guide.
func (c *Client) PutImageTagMutability(ctx context.Context, params *PutImageTagMutabilityInput, optFns ...func(*Options)) (*PutImageTagMutabilityOutput, error) {
if params == nil {
@ -120,6 +119,9 @@ func (c *Client) addOperationPutImageTagMutabilityMiddlewares(stack *middleware.
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutImageTagMutability(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,8 +11,8 @@ import (
)
// Creates or updates the lifecycle policy for the specified repository. For more
// information, see Lifecycle policy template
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html).
// information, see Lifecycle policy template (https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html)
// .
func (c *Client) PutLifecyclePolicy(ctx context.Context, params *PutLifecyclePolicyInput, optFns ...func(*Options)) (*PutLifecyclePolicyOutput, error) {
if params == nil {
params = &PutLifecyclePolicyInput{}
@ -116,6 +116,9 @@ func (c *Client) addOperationPutLifecyclePolicyMiddlewares(stack *middleware.Sta
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutLifecyclePolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -13,8 +13,7 @@ import (
// Creates or updates the permissions policy for your registry. A registry policy
// is used to specify permissions for another Amazon Web Services account and is
// used when configuring cross-account replication. For more information, see
// Registry permissions
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry-permissions.html)
// Registry permissions (https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry-permissions.html)
// in the Amazon Elastic Container Registry User Guide.
func (c *Client) PutRegistryPolicy(ctx context.Context, params *PutRegistryPolicyInput, optFns ...func(*Options)) (*PutRegistryPolicyOutput, error) {
if params == nil {
@ -33,9 +32,8 @@ func (c *Client) PutRegistryPolicy(ctx context.Context, params *PutRegistryPolic
type PutRegistryPolicyInput struct {
// The JSON policy text to apply to your registry. The policy text follows the same
// format as IAM policy text. For more information, see Registry permissions
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry-permissions.html)
// The JSON policy text to apply to your registry. The policy text follows the
// same format as IAM policy text. For more information, see Registry permissions (https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry-permissions.html)
// in the Amazon Elastic Container Registry User Guide.
//
// This member is required.
@ -109,6 +107,9 @@ func (c *Client) addOperationPutRegistryPolicyMiddlewares(stack *middleware.Stac
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutRegistryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -29,16 +29,20 @@ func (c *Client) PutRegistryScanningConfiguration(ctx context.Context, params *P
type PutRegistryScanningConfigurationInput struct {
// The scanning rules to use for the registry. A scanning rule is used to determine
// which repository filters are used and at what frequency scanning will occur.
// The scanning rules to use for the registry. A scanning rule is used to
// determine which repository filters are used and at what frequency scanning will
// occur.
Rules []types.RegistryScanningRule
// The scanning type to set for the registry. By default, the BASIC scan type is
// used. When basic scanning is set, you may specify filters to determine which
// individual repositories, or all repositories, are scanned when new images are
// pushed. Alternatively, you can do manual scans of images with basic scanning.
// When the ENHANCED scan type is set, Amazon Inspector provides automated,
// continuous scanning of all repositories in your registry.
// The scanning type to set for the registry. When a registry scanning
// configuration is not defined, by default the BASIC scan type is used. When
// basic scanning is used, you may specify filters to determine which individual
// repositories, or all repositories, are scanned when new images are pushed to
// those repositories. Alternatively, you can do manual scans of images with basic
// scanning. When the ENHANCED scan type is set, Amazon Inspector provides
// automated vulnerability scanning. You may choose between continuous scanning or
// scan on push and you may specify filters to determine which individual
// repositories, or all repositories, are scanned.
ScanType types.ScanType
noSmithyDocumentSerde
@ -106,6 +110,9 @@ func (c *Client) addOperationPutRegistryScanningConfigurationMiddlewares(stack *
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutRegistryScanningConfiguration(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -16,12 +16,11 @@ import (
// DescribeRegistry API action. The first time the PutReplicationConfiguration API
// is called, a service-linked IAM role is created in your account for the
// replication process. For more information, see Using service-linked roles for
// Amazon ECR
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/using-service-linked-roles.html)
// Amazon ECR (https://docs.aws.amazon.com/AmazonECR/latest/userguide/using-service-linked-roles.html)
// in the Amazon Elastic Container Registry User Guide. When configuring
// cross-account replication, the destination account must grant the source account
// permission to replicate. This permission is controlled using a registry
// permissions policy. For more information, see PutRegistryPolicy.
// permissions policy. For more information, see PutRegistryPolicy .
func (c *Client) PutReplicationConfiguration(ctx context.Context, params *PutReplicationConfigurationInput, optFns ...func(*Options)) (*PutReplicationConfigurationOutput, error) {
if params == nil {
params = &PutReplicationConfigurationInput{}
@ -109,6 +108,9 @@ func (c *Client) addOperationPutReplicationConfigurationMiddlewares(stack *middl
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutReplicationConfiguration(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,8 +11,7 @@ import (
)
// Applies a repository policy to the specified repository to control access
// permissions. For more information, see Amazon ECR Repository policies
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policies.html)
// permissions. For more information, see Amazon ECR Repository policies (https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policies.html)
// in the Amazon Elastic Container Registry User Guide.
func (c *Client) SetRepositoryPolicy(ctx context.Context, params *SetRepositoryPolicyInput, optFns ...func(*Options)) (*SetRepositoryPolicyOutput, error) {
if params == nil {
@ -32,8 +31,7 @@ func (c *Client) SetRepositoryPolicy(ctx context.Context, params *SetRepositoryP
type SetRepositoryPolicyInput struct {
// The JSON repository policy text to apply to the repository. For more
// information, see Amazon ECR repository policies
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html)
// information, see Amazon ECR repository policies (https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html)
// in the Amazon Elastic Container Registry User Guide.
//
// This member is required.
@ -44,8 +42,8 @@ type SetRepositoryPolicyInput struct {
// This member is required.
RepositoryName *string
// If the policy you are attempting to set on a repository policy would prevent you
// from setting another policy in the future, you must force the
// If the policy you are attempting to set on a repository policy would prevent
// you from setting another policy in the future, you must force the
// SetRepositoryPolicy operation. This is intended to prevent accidental repository
// lock outs.
Force bool
@ -126,6 +124,9 @@ func (c *Client) addOperationSetRepositoryPolicyMiddlewares(stack *middleware.St
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetRepositoryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -13,9 +13,8 @@ import (
// Starts an image vulnerability scan. An image scan can only be started once per
// 24 hours on an individual image. This limit includes if an image was scanned on
// initial push. For more information, see Image scanning
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) in
// the Amazon Elastic Container Registry User Guide.
// initial push. For more information, see Image scanning (https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html)
// in the Amazon Elastic Container Registry User Guide.
func (c *Client) StartImageScan(ctx context.Context, params *StartImageScanInput, optFns ...func(*Options)) (*StartImageScanOutput, error) {
if params == nil {
params = &StartImageScanInput{}
@ -122,6 +121,9 @@ func (c *Client) addOperationStartImageScanMiddlewares(stack *middleware.Stack,
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartImageScan(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,8 +11,8 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts a preview of a lifecycle policy for the specified repository. This allows
// you to see the results before associating the lifecycle policy with the
// Starts a preview of a lifecycle policy for the specified repository. This
// allows you to see the results before associating the lifecycle policy with the
// repository.
func (c *Client) StartLifecyclePolicyPreview(ctx context.Context, params *StartLifecyclePolicyPreviewInput, optFns ...func(*Options)) (*StartLifecyclePolicyPreviewOutput, error) {
if params == nil {
@ -119,6 +119,9 @@ func (c *Client) addOperationStartLifecyclePolicyPreviewMiddlewares(stack *middl
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartLifecyclePolicyPreview(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -104,6 +104,9 @@ func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, opt
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -100,6 +100,9 @@ func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, o
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -59,9 +59,9 @@ type UploadLayerPartInput struct {
// This member is required.
UploadId *string
// The Amazon Web Services account ID associated with the registry to which you are
// uploading layer parts. If you do not specify a registry, the default registry is
// assumed.
// The Amazon Web Services account ID associated with the registry to which you
// are uploading layer parts. If you do not specify a registry, the default
// registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -138,6 +138,9 @@ func (c *Client) addOperationUploadLayerPartMiddlewares(stack *middleware.Stack,
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUploadLayerPart(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

File diff suppressed because it is too large Load Diff

View File

@ -3,14 +3,14 @@
// Package ecr provides the API client, operations, and parameter types for Amazon
// EC2 Container Registry.
//
// Amazon Elastic Container Registry Amazon Elastic Container Registry (Amazon ECR)
// is a managed container image registry service. Customers can use the familiar
// Docker CLI, or their preferred client, to push, pull, and manage images. Amazon
// ECR provides a secure, scalable, and reliable registry for your Docker or Open
// Container Initiative (OCI) images. Amazon ECR supports private repositories with
// resource-based permissions using IAM so that specific users or Amazon EC2
// instances can access repositories and images. Amazon ECR has service endpoints
// in each supported Region. For more information, see Amazon ECR endpoints
// (https://docs.aws.amazon.com/general/latest/gr/ecr.html) in the Amazon Web
// Services General Reference.
// Amazon Elastic Container Registry Amazon Elastic Container Registry (Amazon
// ECR) is a managed container image registry service. Customers can use the
// familiar Docker CLI, or their preferred client, to push, pull, and manage
// images. Amazon ECR provides a secure, scalable, and reliable registry for your
// Docker or Open Container Initiative (OCI) images. Amazon ECR supports private
// repositories with resource-based permissions using IAM so that specific users or
// Amazon EC2 instances can access repositories and images. Amazon ECR has service
// endpoints in each supported Region. For more information, see Amazon ECR
// endpoints (https://docs.aws.amazon.com/general/latest/gr/ecr.html) in the Amazon
// Web Services General Reference.
package ecr

View File

@ -3,4 +3,4 @@
package ecr
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.15.0"
const goModuleVersion = "1.18.10"

View File

@ -183,6 +183,14 @@ var defaultPartitions = endpoints.Partitions{
Region: "ap-south-1",
},
},
endpoints.EndpointKey{
Region: "ap-south-2",
}: endpoints.Endpoint{
Hostname: "api.ecr.ap-south-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "ap-south-2",
},
},
endpoints.EndpointKey{
Region: "ap-southeast-1",
}: endpoints.Endpoint{
@ -207,6 +215,14 @@ var defaultPartitions = endpoints.Partitions{
Region: "ap-southeast-3",
},
},
endpoints.EndpointKey{
Region: "ap-southeast-4",
}: endpoints.Endpoint{
Hostname: "api.ecr.ap-southeast-4.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "ap-southeast-4",
},
},
endpoints.EndpointKey{
Region: "ca-central-1",
}: endpoints.Endpoint{
@ -295,6 +311,14 @@ var defaultPartitions = endpoints.Partitions{
Region: "eu-central-1",
},
},
endpoints.EndpointKey{
Region: "eu-central-2",
}: endpoints.Endpoint{
Hostname: "api.ecr.eu-central-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "eu-central-2",
},
},
endpoints.EndpointKey{
Region: "eu-north-1",
}: endpoints.Endpoint{
@ -311,6 +335,14 @@ var defaultPartitions = endpoints.Partitions{
Region: "eu-south-1",
},
},
endpoints.EndpointKey{
Region: "eu-south-2",
}: endpoints.Endpoint{
Hostname: "api.ecr.eu-south-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "eu-south-2",
},
},
endpoints.EndpointKey{
Region: "eu-west-1",
}: endpoints.Endpoint{
@ -407,6 +439,14 @@ var defaultPartitions = endpoints.Partitions{
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "me-central-1",
}: endpoints.Endpoint{
Hostname: "api.ecr.me-central-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "me-central-1",
},
},
endpoints.EndpointKey{
Region: "me-south-1",
}: endpoints.Endpoint{

View File

@ -154,9 +154,10 @@ const (
LifecyclePolicyPreviewStatusFailed LifecyclePolicyPreviewStatus = "FAILED"
)
// Values returns all known values for LifecyclePolicyPreviewStatus. Note that this
// can be expanded in the future, and so it is only as up to date as the client.
// The ordering of this slice is not guaranteed to be stable across updates.
// Values returns all known values for LifecyclePolicyPreviewStatus. Note that
// this can be expanded in the future, and so it is only as up to date as the
// client. The ordering of this slice is not guaranteed to be stable across
// updates.
func (LifecyclePolicyPreviewStatus) Values() []LifecyclePolicyPreviewStatus {
return []LifecyclePolicyPreviewStatus{
"IN_PROGRESS",
@ -246,9 +247,10 @@ const (
ScanningRepositoryFilterTypeWildcard ScanningRepositoryFilterType = "WILDCARD"
)
// Values returns all known values for ScanningRepositoryFilterType. Note that this
// can be expanded in the future, and so it is only as up to date as the client.
// The ordering of this slice is not guaranteed to be stable across updates.
// Values returns all known values for ScanningRepositoryFilterType. Note that
// this can be expanded in the future, and so it is only as up to date as the
// client. The ordering of this slice is not guaranteed to be stable across
// updates.
func (ScanningRepositoryFilterType) Values() []ScanningRepositoryFilterType {
return []ScanningRepositoryFilterType{
"WILDCARD",
@ -312,9 +314,9 @@ const (
TagStatusAny TagStatus = "ANY"
)
// Values returns all known values for TagStatus. Note that this can be expanded in
// the future, and so it is only as up to date as the client. The ordering of this
// slice is not guaranteed to be stable across updates.
// Values returns all known values for TagStatus. Note that this can be expanded
// in the future, and so it is only as up to date as the client. The ordering of
// this slice is not guaranteed to be stable across updates.
func (TagStatus) Values() []TagStatus {
return []TagStatus{
"TAGGED",

View File

@ -11,6 +11,8 @@ import (
type EmptyUploadException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -23,7 +25,12 @@ func (e *EmptyUploadException) ErrorMessage() string {
}
return *e.Message
}
func (e *EmptyUploadException) ErrorCode() string { return "EmptyUploadException" }
func (e *EmptyUploadException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "EmptyUploadException"
}
return *e.ErrorCodeOverride
}
func (e *EmptyUploadException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified image has already been pushed, and there were no changes to the
@ -31,6 +38,8 @@ func (e *EmptyUploadException) ErrorFault() smithy.ErrorFault { return smithy.Fa
type ImageAlreadyExistsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -43,7 +52,12 @@ func (e *ImageAlreadyExistsException) ErrorMessage() string {
}
return *e.Message
}
func (e *ImageAlreadyExistsException) ErrorCode() string { return "ImageAlreadyExistsException" }
func (e *ImageAlreadyExistsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ImageAlreadyExistsException"
}
return *e.ErrorCodeOverride
}
func (e *ImageAlreadyExistsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified image digest does not match the digest that Amazon ECR calculated
@ -51,6 +65,8 @@ func (e *ImageAlreadyExistsException) ErrorFault() smithy.ErrorFault { return sm
type ImageDigestDoesNotMatchException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -64,7 +80,10 @@ func (e *ImageDigestDoesNotMatchException) ErrorMessage() string {
return *e.Message
}
func (e *ImageDigestDoesNotMatchException) ErrorCode() string {
return "ImageDigestDoesNotMatchException"
if e == nil || e.ErrorCodeOverride == nil {
return "ImageDigestDoesNotMatchException"
}
return *e.ErrorCodeOverride
}
func (e *ImageDigestDoesNotMatchException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
@ -72,6 +91,8 @@ func (e *ImageDigestDoesNotMatchException) ErrorFault() smithy.ErrorFault { retu
type ImageNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -84,7 +105,12 @@ func (e *ImageNotFoundException) ErrorMessage() string {
}
return *e.Message
}
func (e *ImageNotFoundException) ErrorCode() string { return "ImageNotFoundException" }
func (e *ImageNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ImageNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *ImageNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified image is tagged with a tag that already exists. The repository is
@ -92,6 +118,8 @@ func (e *ImageNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.
type ImageTagAlreadyExistsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -104,7 +132,12 @@ func (e *ImageTagAlreadyExistsException) ErrorMessage() string {
}
return *e.Message
}
func (e *ImageTagAlreadyExistsException) ErrorCode() string { return "ImageTagAlreadyExistsException" }
func (e *ImageTagAlreadyExistsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ImageTagAlreadyExistsException"
}
return *e.ErrorCodeOverride
}
func (e *ImageTagAlreadyExistsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The layer digest calculation performed by Amazon ECR upon receipt of the image
@ -112,6 +145,8 @@ func (e *ImageTagAlreadyExistsException) ErrorFault() smithy.ErrorFault { return
type InvalidLayerException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -124,14 +159,21 @@ func (e *InvalidLayerException) ErrorMessage() string {
}
return *e.Message
}
func (e *InvalidLayerException) ErrorCode() string { return "InvalidLayerException" }
func (e *InvalidLayerException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidLayerException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidLayerException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The layer part size is not valid, or the first byte specified is not consecutive
// to the last byte of a previous layer part upload.
// The layer part size is not valid, or the first byte specified is not
// consecutive to the last byte of a previous layer part upload.
type InvalidLayerPartException struct {
Message *string
ErrorCodeOverride *string
RegistryId *string
RepositoryName *string
UploadId *string
@ -149,7 +191,12 @@ func (e *InvalidLayerPartException) ErrorMessage() string {
}
return *e.Message
}
func (e *InvalidLayerPartException) ErrorCode() string { return "InvalidLayerPartException" }
func (e *InvalidLayerPartException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidLayerPartException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidLayerPartException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified parameter is invalid. Review the available parameters for the API
@ -157,6 +204,8 @@ func (e *InvalidLayerPartException) ErrorFault() smithy.ErrorFault { return smit
type InvalidParameterException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -169,7 +218,12 @@ func (e *InvalidParameterException) ErrorMessage() string {
}
return *e.Message
}
func (e *InvalidParameterException) ErrorCode() string { return "InvalidParameterException" }
func (e *InvalidParameterException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidParameterException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// An invalid parameter has been specified. Tag keys can have a maximum character
@ -178,6 +232,8 @@ func (e *InvalidParameterException) ErrorFault() smithy.ErrorFault { return smit
type InvalidTagParameterException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -190,13 +246,20 @@ func (e *InvalidTagParameterException) ErrorMessage() string {
}
return *e.Message
}
func (e *InvalidTagParameterException) ErrorCode() string { return "InvalidTagParameterException" }
func (e *InvalidTagParameterException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidTagParameterException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidTagParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed due to a KMS exception.
type KmsException struct {
Message *string
ErrorCodeOverride *string
KmsError *string
noSmithyDocumentSerde
@ -211,13 +274,20 @@ func (e *KmsException) ErrorMessage() string {
}
return *e.Message
}
func (e *KmsException) ErrorCode() string { return "KmsException" }
func (e *KmsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "KmsException"
}
return *e.ErrorCodeOverride
}
func (e *KmsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The image layer already exists in the associated repository.
type LayerAlreadyExistsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -230,14 +300,21 @@ func (e *LayerAlreadyExistsException) ErrorMessage() string {
}
return *e.Message
}
func (e *LayerAlreadyExistsException) ErrorCode() string { return "LayerAlreadyExistsException" }
func (e *LayerAlreadyExistsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "LayerAlreadyExistsException"
}
return *e.ErrorCodeOverride
}
func (e *LayerAlreadyExistsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified layer is not available because it is not associated with an image.
// Unassociated image layers may be cleaned up at any time.
// The specified layer is not available because it is not associated with an
// image. Unassociated image layers may be cleaned up at any time.
type LayerInaccessibleException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -250,13 +327,20 @@ func (e *LayerInaccessibleException) ErrorMessage() string {
}
return *e.Message
}
func (e *LayerInaccessibleException) ErrorCode() string { return "LayerInaccessibleException" }
func (e *LayerInaccessibleException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "LayerInaccessibleException"
}
return *e.ErrorCodeOverride
}
func (e *LayerInaccessibleException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// Layer parts must be at least 5 MiB in size.
type LayerPartTooSmallException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -269,14 +353,21 @@ func (e *LayerPartTooSmallException) ErrorMessage() string {
}
return *e.Message
}
func (e *LayerPartTooSmallException) ErrorCode() string { return "LayerPartTooSmallException" }
func (e *LayerPartTooSmallException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "LayerPartTooSmallException"
}
return *e.ErrorCodeOverride
}
func (e *LayerPartTooSmallException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified layers could not be found, or the specified layer is not valid for
// this repository.
// The specified layers could not be found, or the specified layer is not valid
// for this repository.
type LayersNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -289,13 +380,20 @@ func (e *LayersNotFoundException) ErrorMessage() string {
}
return *e.Message
}
func (e *LayersNotFoundException) ErrorCode() string { return "LayersNotFoundException" }
func (e *LayersNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "LayersNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *LayersNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The lifecycle policy could not be found, and no policy is set to the repository.
type LifecyclePolicyNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -309,7 +407,10 @@ func (e *LifecyclePolicyNotFoundException) ErrorMessage() string {
return *e.Message
}
func (e *LifecyclePolicyNotFoundException) ErrorCode() string {
return "LifecyclePolicyNotFoundException"
if e == nil || e.ErrorCodeOverride == nil {
return "LifecyclePolicyNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *LifecyclePolicyNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
@ -318,6 +419,8 @@ func (e *LifecyclePolicyNotFoundException) ErrorFault() smithy.ErrorFault { retu
type LifecyclePolicyPreviewInProgressException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -331,7 +434,10 @@ func (e *LifecyclePolicyPreviewInProgressException) ErrorMessage() string {
return *e.Message
}
func (e *LifecyclePolicyPreviewInProgressException) ErrorCode() string {
return "LifecyclePolicyPreviewInProgressException"
if e == nil || e.ErrorCodeOverride == nil {
return "LifecyclePolicyPreviewInProgressException"
}
return *e.ErrorCodeOverride
}
func (e *LifecyclePolicyPreviewInProgressException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
@ -341,6 +447,8 @@ func (e *LifecyclePolicyPreviewInProgressException) ErrorFault() smithy.ErrorFau
type LifecyclePolicyPreviewNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -354,19 +462,23 @@ func (e *LifecyclePolicyPreviewNotFoundException) ErrorMessage() string {
return *e.Message
}
func (e *LifecyclePolicyPreviewNotFoundException) ErrorCode() string {
return "LifecyclePolicyPreviewNotFoundException"
if e == nil || e.ErrorCodeOverride == nil {
return "LifecyclePolicyPreviewNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *LifecyclePolicyPreviewNotFoundException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation did not succeed because it would have exceeded a service limit for
// your account. For more information, see Amazon ECR service quotas
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/service-quotas.html) in
// the Amazon Elastic Container Registry User Guide.
// The operation did not succeed because it would have exceeded a service limit
// for your account. For more information, see Amazon ECR service quotas (https://docs.aws.amazon.com/AmazonECR/latest/userguide/service-quotas.html)
// in the Amazon Elastic Container Registry User Guide.
type LimitExceededException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -379,7 +491,12 @@ func (e *LimitExceededException) ErrorMessage() string {
}
return *e.Message
}
func (e *LimitExceededException) ErrorCode() string { return "LimitExceededException" }
func (e *LimitExceededException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "LimitExceededException"
}
return *e.ErrorCodeOverride
}
func (e *LimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// A pull through cache rule with these settings already exists for the private
@ -387,6 +504,8 @@ func (e *LimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.
type PullThroughCacheRuleAlreadyExistsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -400,7 +519,10 @@ func (e *PullThroughCacheRuleAlreadyExistsException) ErrorMessage() string {
return *e.Message
}
func (e *PullThroughCacheRuleAlreadyExistsException) ErrorCode() string {
return "PullThroughCacheRuleAlreadyExistsException"
if e == nil || e.ErrorCodeOverride == nil {
return "PullThroughCacheRuleAlreadyExistsException"
}
return *e.ErrorCodeOverride
}
func (e *PullThroughCacheRuleAlreadyExistsException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
@ -411,6 +533,8 @@ func (e *PullThroughCacheRuleAlreadyExistsException) ErrorFault() smithy.ErrorFa
type PullThroughCacheRuleNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -424,7 +548,10 @@ func (e *PullThroughCacheRuleNotFoundException) ErrorMessage() string {
return *e.Message
}
func (e *PullThroughCacheRuleNotFoundException) ErrorCode() string {
return "PullThroughCacheRuleNotFoundException"
if e == nil || e.ErrorCodeOverride == nil {
return "PullThroughCacheRuleNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *PullThroughCacheRuleNotFoundException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
@ -434,6 +561,8 @@ func (e *PullThroughCacheRuleNotFoundException) ErrorFault() smithy.ErrorFault {
type ReferencedImagesNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -447,7 +576,10 @@ func (e *ReferencedImagesNotFoundException) ErrorMessage() string {
return *e.Message
}
func (e *ReferencedImagesNotFoundException) ErrorCode() string {
return "ReferencedImagesNotFoundException"
if e == nil || e.ErrorCodeOverride == nil {
return "ReferencedImagesNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *ReferencedImagesNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
@ -455,6 +587,8 @@ func (e *ReferencedImagesNotFoundException) ErrorFault() smithy.ErrorFault { ret
type RegistryPolicyNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -468,7 +602,10 @@ func (e *RegistryPolicyNotFoundException) ErrorMessage() string {
return *e.Message
}
func (e *RegistryPolicyNotFoundException) ErrorCode() string {
return "RegistryPolicyNotFoundException"
if e == nil || e.ErrorCodeOverride == nil {
return "RegistryPolicyNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *RegistryPolicyNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
@ -476,6 +613,8 @@ func (e *RegistryPolicyNotFoundException) ErrorFault() smithy.ErrorFault { retur
type RepositoryAlreadyExistsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -489,7 +628,10 @@ func (e *RepositoryAlreadyExistsException) ErrorMessage() string {
return *e.Message
}
func (e *RepositoryAlreadyExistsException) ErrorCode() string {
return "RepositoryAlreadyExistsException"
if e == nil || e.ErrorCodeOverride == nil {
return "RepositoryAlreadyExistsException"
}
return *e.ErrorCodeOverride
}
func (e *RepositoryAlreadyExistsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
@ -498,6 +640,8 @@ func (e *RepositoryAlreadyExistsException) ErrorFault() smithy.ErrorFault { retu
type RepositoryNotEmptyException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -510,15 +654,22 @@ func (e *RepositoryNotEmptyException) ErrorMessage() string {
}
return *e.Message
}
func (e *RepositoryNotEmptyException) ErrorCode() string { return "RepositoryNotEmptyException" }
func (e *RepositoryNotEmptyException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "RepositoryNotEmptyException"
}
return *e.ErrorCodeOverride
}
func (e *RepositoryNotEmptyException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified repository could not be found. Check the spelling of the specified
// repository and ensure that you are performing operations on the correct
// registry.
// The specified repository could not be found. Check the spelling of the
// specified repository and ensure that you are performing operations on the
// correct registry.
type RepositoryNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -531,7 +682,12 @@ func (e *RepositoryNotFoundException) ErrorMessage() string {
}
return *e.Message
}
func (e *RepositoryNotFoundException) ErrorCode() string { return "RepositoryNotFoundException" }
func (e *RepositoryNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "RepositoryNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *RepositoryNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified repository and registry combination does not have an associated
@ -539,6 +695,8 @@ func (e *RepositoryNotFoundException) ErrorFault() smithy.ErrorFault { return sm
type RepositoryPolicyNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -552,7 +710,10 @@ func (e *RepositoryPolicyNotFoundException) ErrorMessage() string {
return *e.Message
}
func (e *RepositoryPolicyNotFoundException) ErrorCode() string {
return "RepositoryPolicyNotFoundException"
if e == nil || e.ErrorCodeOverride == nil {
return "RepositoryPolicyNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *RepositoryPolicyNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
@ -561,6 +722,8 @@ func (e *RepositoryPolicyNotFoundException) ErrorFault() smithy.ErrorFault { ret
type ScanNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -573,13 +736,20 @@ func (e *ScanNotFoundException) ErrorMessage() string {
}
return *e.Message
}
func (e *ScanNotFoundException) ErrorCode() string { return "ScanNotFoundException" }
func (e *ScanNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ScanNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *ScanNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// These errors are usually caused by a server-side issue.
type ServerException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -592,14 +762,21 @@ func (e *ServerException) ErrorMessage() string {
}
return *e.Message
}
func (e *ServerException) ErrorCode() string { return "ServerException" }
func (e *ServerException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ServerException"
}
return *e.ErrorCodeOverride
}
func (e *ServerException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
// The list of tags on the repository is over the limit. The maximum number of tags
// that can be applied to a repository is 50.
// The list of tags on the repository is over the limit. The maximum number of
// tags that can be applied to a repository is 50.
type TooManyTagsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -612,13 +789,20 @@ func (e *TooManyTagsException) ErrorMessage() string {
}
return *e.Message
}
func (e *TooManyTagsException) ErrorCode() string { return "TooManyTagsException" }
func (e *TooManyTagsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "TooManyTagsException"
}
return *e.ErrorCodeOverride
}
func (e *TooManyTagsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The image is of a type that cannot be scanned.
type UnsupportedImageTypeException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -631,13 +815,20 @@ func (e *UnsupportedImageTypeException) ErrorMessage() string {
}
return *e.Message
}
func (e *UnsupportedImageTypeException) ErrorCode() string { return "UnsupportedImageTypeException" }
func (e *UnsupportedImageTypeException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "UnsupportedImageTypeException"
}
return *e.ErrorCodeOverride
}
func (e *UnsupportedImageTypeException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The specified upstream registry isn't supported.
type UnsupportedUpstreamRegistryException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -651,7 +842,10 @@ func (e *UnsupportedUpstreamRegistryException) ErrorMessage() string {
return *e.Message
}
func (e *UnsupportedUpstreamRegistryException) ErrorCode() string {
return "UnsupportedUpstreamRegistryException"
if e == nil || e.ErrorCodeOverride == nil {
return "UnsupportedUpstreamRegistryException"
}
return *e.ErrorCodeOverride
}
func (e *UnsupportedUpstreamRegistryException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
@ -662,6 +856,8 @@ func (e *UnsupportedUpstreamRegistryException) ErrorFault() smithy.ErrorFault {
type UploadNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -674,13 +870,20 @@ func (e *UploadNotFoundException) ErrorMessage() string {
}
return *e.Message
}
func (e *UploadNotFoundException) ErrorCode() string { return "UploadNotFoundException" }
func (e *UploadNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "UploadNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *UploadNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// There was an exception validating this request.
type ValidationException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
@ -693,5 +896,10 @@ func (e *ValidationException) ErrorMessage() string {
}
return *e.Message
}
func (e *ValidationException) ErrorCode() string { return "ValidationException" }
func (e *ValidationException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ValidationException"
}
return *e.ErrorCodeOverride
}
func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }

View File

@ -26,7 +26,7 @@ type AuthorizationData struct {
// A base64-encoded string that contains authorization data for the specified
// Amazon ECR registry. When the string is decoded, it is presented in the format
// user:password for private registry authentication using docker login.
// user:password for private registry authentication using docker login .
AuthorizationToken *string
// The Unix time in seconds and milliseconds when the authorization token expires.
@ -35,8 +35,8 @@ type AuthorizationData struct {
// The registry URL to use for this authorization token in a docker login command.
// The Amazon ECR registry URL format is
// https://aws_account_id.dkr.ecr.region.amazonaws.com. For example,
// https://012345678910.dkr.ecr.us-east-1.amazonaws.com..
// https://aws_account_id.dkr.ecr.region.amazonaws.com . For example,
// https://012345678910.dkr.ecr.us-east-1.amazonaws.com ..
ProxyEndpoint *string
noSmithyDocumentSerde
@ -128,7 +128,7 @@ type CvssScoreDetails struct {
type DescribeImagesFilter struct {
// The tag status with which to filter your DescribeImages results. You can filter
// results based on whether they are TAGGED or UNTAGGED.
// results based on whether they are TAGGED or UNTAGGED .
TagStatus TagStatus
noSmithyDocumentSerde
@ -142,8 +142,7 @@ type DescribeImagesFilter struct {
// require any action on your part. For more control over the encryption of the
// contents of your repository, you can use server-side encryption with Key
// Management Service key stored in Key Management Service (KMS) to encrypt your
// images. For more information, see Amazon ECR encryption at rest
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html)
// images. For more information, see Amazon ECR encryption at rest (https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html)
// in the Amazon Elastic Container Registry User Guide.
type EncryptionConfiguration struct {
@ -153,14 +152,12 @@ type EncryptionConfiguration struct {
// can either use the default Amazon Web Services managed KMS key for Amazon ECR,
// or specify your own KMS key, which you already created. For more information,
// see Protecting data using server-side encryption with an KMS key stored in Key
// Management Service (SSE-KMS)
// (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html) in the
// Amazon Simple Storage Service Console Developer Guide. If you use the AES256
// encryption type, Amazon ECR uses server-side encryption with Amazon S3-managed
// encryption keys which encrypts the images in the repository using an AES-256
// encryption algorithm. For more information, see Protecting data using
// server-side encryption with Amazon S3-managed encryption keys (SSE-S3)
// (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html)
// Management Service (SSE-KMS) (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingKMSEncryption.html)
// in the Amazon Simple Storage Service Console Developer Guide. If you use the
// AES256 encryption type, Amazon ECR uses server-side encryption with Amazon
// S3-managed encryption keys which encrypts the images in the repository using an
// AES-256 encryption algorithm. For more information, see Protecting data using
// server-side encryption with Amazon S3-managed encryption keys (SSE-S3) (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html)
// in the Amazon Simple Storage Service Console Developer Guide.
//
// This member is required.
@ -276,12 +273,21 @@ type ImageDetail struct {
// Docker version 1.9, the Docker client compresses image layers before pushing
// them to a V2 Docker registry. The output of the docker images command shows the
// uncompressed image size, so it may return a larger image size than the image
// sizes returned by DescribeImages.
// sizes returned by DescribeImages .
ImageSizeInBytes *int64
// The list of tags associated with this image.
ImageTags []string
// The date and time, expressed in standard JavaScript date format, when Amazon
// ECR recorded the last image pull. Amazon ECR refreshes the last image pull
// timestamp at least once every 24 hours. For example, if you pull an image once a
// day then the lastRecordedPullTime timestamp will indicate the exact time that
// the image was last pulled. However, if you pull an image once an hour, because
// Amazon ECR refreshes the lastRecordedPullTime timestamp at least once every 24
// hours, the result may not be the exact time that the image was last pulled.
LastRecordedPullTime *time.Time
// The Amazon Web Services account ID associated with the registry to which this
// image belongs.
RegistryId *string
@ -399,10 +405,9 @@ type ImageScanFindingsSummary struct {
type ImageScanningConfiguration struct {
// The setting that determines whether images are scanned after being pushed to a
// repository. If set to true, images will be scanned after being pushed. If this
// repository. If set to true , images will be scanned after being pushed. If this
// parameter is not specified, it will default to false and images will not be
// scanned unless a scan is manually started with the API_StartImageScan
// (https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_StartImageScan.html)
// scanned unless a scan is manually started with the API_StartImageScan (https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_StartImageScan.html)
// API.
ScanOnPush bool
@ -435,7 +440,7 @@ type Layer struct {
// The media type of the layer, such as
// application/vnd.docker.image.rootfs.diff.tar.gzip or
// application/vnd.oci.image.layer.v1.tar+gzip.
// application/vnd.oci.image.layer.v1.tar+gzip .
MediaType *string
noSmithyDocumentSerde
@ -509,7 +514,7 @@ type LifecyclePolicyRuleAction struct {
type ListImagesFilter struct {
// The tag status with which to filter your ListImages results. You can filter
// results based on whether they are TAGGED or UNTAGGED.
// results based on whether they are TAGGED or UNTAGGED .
TagStatus TagStatus
noSmithyDocumentSerde
@ -561,8 +566,8 @@ type PullThroughCacheRule struct {
// The Amazon ECR repository prefix associated with the pull through cache rule.
EcrRepositoryPrefix *string
// The Amazon Web Services account ID associated with the registry the pull through
// cache rule is associated with.
// The Amazon Web Services account ID associated with the registry the pull
// through cache rule is associated with.
RegistryId *string
// The upstream registry URL associated with the pull through cache rule.
@ -604,7 +609,10 @@ type RegistryScanningRule struct {
// This member is required.
RepositoryFilters []ScanningRepositoryFilter
// The frequency that scans are performed at for a private registry.
// The frequency that scans are performed at for a private registry. When the
// ENHANCED scan type is specified, the supported scan frequencies are
// CONTINUOUS_SCAN and SCAN_ON_PUSH . When the BASIC scan type is specified, the
// SCAN_ON_PUSH and MANUAL scan frequencies are supported.
//
// This member is required.
ScanFrequency ScanFrequency
@ -692,7 +700,7 @@ type Repository struct {
// The Amazon Resource Name (ARN) that identifies the repository. The ARN contains
// the arn:aws:ecr namespace, followed by the region of the repository, Amazon Web
// Services account ID of the repository owner, repository namespace, and
// repository name. For example, arn:aws:ecr:region:012345678910:repository/test.
// repository name. For example, arn:aws:ecr:region:012345678910:repository/test .
RepositoryArn *string
// The name of the repository.
@ -718,8 +726,8 @@ type RepositoryFilter struct {
// This member is required.
Filter *string
// The repository filter type. The only supported value is PREFIX_MATCH, which is a
// repository name prefix specified with the filter parameter.
// The repository filter type. The only supported value is PREFIX_MATCH , which is
// a repository name prefix specified with the filter parameter.
//
// This member is required.
FilterType RepositoryFilterType
@ -785,14 +793,16 @@ type Resource struct {
// Contains details about the resource involved in the finding.
type ResourceDetails struct {
// An object that contains details about the Amazon ECR container image involved in
// the finding.
// An object that contains details about the Amazon ECR container image involved
// in the finding.
AwsEcrContainerImage *AwsEcrContainerImageDetails
noSmithyDocumentSerde
}
// The details of a scanning repository filter.
// The details of a scanning repository filter. For more information on how to use
// filters, see Using filters (https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html#image-scanning-filters)
// in the Amazon Elastic Container Registry User Guide.
type ScanningRepositoryFilter struct {
// The filter to use when scanning.
@ -817,18 +827,17 @@ type ScoreDetails struct {
noSmithyDocumentSerde
}
// The metadata that you apply to a resource to help you categorize and organize
// them. Each tag consists of a key and an optional value, both of which you
// define. Tag keys can have a maximum character length of 128 characters, and tag
// values can have a maximum length of 256 characters.
// The metadata to apply to a resource to help you categorize and organize them.
// Each tag consists of a key and a value, both of which you define. Tag keys can
// have a maximum character length of 128 characters, and tag values can have a
// maximum length of 256 characters.
type Tag struct {
// One part of a key-value pair that make up a tag. A key is a general label that
// acts like a category for more specific tag values.
Key *string
// The optional part of a key-value pair that make up a tag. A value acts as a
// descriptor within a tag category (key).
// A value acts as a descriptor within a tag category (key).
Value *string
noSmithyDocumentSerde

View File

@ -1,3 +1,145 @@
# v1.16.1 (2023-04-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.16.0 (2023-04-11)
* **Feature**: This release will allow using registry alias as registryId in BatchDeleteImage request.
# v1.15.8 (2023-04-10)
* No change notes available for this release.
# v1.15.7 (2023-04-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.6 (2023-03-21)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.5 (2023-03-10)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.4 (2023-02-22)
* **Bug Fix**: Prevent nil pointer dereference when retrieving error codes.
# v1.15.3 (2023-02-20)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.2 (2023-02-15)
* **Announcement**: When receiving an error response in restJson-based services, an incorrect error type may have been returned based on the content of the response. This has been fixed via PR #2012 tracked in issue #1910.
* **Bug Fix**: Correct error type parsing for restJson services.
# v1.15.1 (2023-02-03)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.0 (2023-01-09)
* **Feature**: This release for Amazon ECR Public makes several change to bring the SDK into sync with the API.
# v1.14.0 (2023-01-05)
* **Feature**: Add `ErrorCodeOverride` field to all error structs (aws/smithy-go#401).
# v1.13.22 (2022-12-15)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.21 (2022-12-02)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.20 (2022-11-30)
* No change notes available for this release.
# v1.13.19 (2022-10-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.18 (2022-10-21)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.17 (2022-09-20)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.16 (2022-09-14)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.15 (2022-09-02)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.14 (2022-08-31)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.13 (2022-08-29)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.12 (2022-08-11)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.11 (2022-08-09)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.10 (2022-08-08)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.9 (2022-08-01)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.8 (2022-07-05)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.7 (2022-06-29)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.6 (2022-06-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.5 (2022-05-17)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.4 (2022-04-25)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.3 (2022-03-30)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.2 (2022-03-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.1 (2022-03-23)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.13.0 (2022-03-08)
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
* **Dependency Update**: Updated to the latest SDK module versions
# v1.12.0 (2022-02-24)
* **Feature**: API client updated

View File

@ -115,7 +115,7 @@ type Options struct {
Retryer aws.Retryer
// The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig. You
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You
// should not populate this structure programmatically, or rely on the values here
// within your applications.
RuntimeEnvironment aws.RuntimeEnvironment

View File

@ -11,12 +11,12 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Checks the availability of one or more image layers within a repository in a
// public registry. When an image is pushed to a repository, each image layer is
// checked to verify if it has been uploaded before. If it has been uploaded, then
// the image layer is skipped. This operation is used by the Amazon ECR proxy and
// is not generally used by customers for pulling and pushing images. In most
// cases, you should use the docker CLI to pull, tag, and push images.
// Checks the availability of one or more image layers that are within a
// repository in a public registry. When an image is pushed to a repository, each
// image layer is checked to verify if it has been uploaded before. If it has been
// uploaded, then the image layer is skipped. This operation is used by the Amazon
// ECR proxy and is not generally used by customers for pulling and pushing images.
// In most cases, you should use the docker CLI to pull, tag, and push images.
func (c *Client) BatchCheckLayerAvailability(ctx context.Context, params *BatchCheckLayerAvailabilityInput, optFns ...func(*Options)) (*BatchCheckLayerAvailabilityOutput, error) {
if params == nil {
params = &BatchCheckLayerAvailabilityInput{}
@ -39,14 +39,14 @@ type BatchCheckLayerAvailabilityInput struct {
// This member is required.
LayerDigests []string
// The name of the repository that is associated with the image layers to check.
// The name of the repository that's associated with the image layers to check.
//
// This member is required.
RepositoryName *string
// The AWS account ID associated with the public registry that contains the image
// layers to check. If you do not specify a registry, the default public registry
// is assumed.
// The Amazon Web Services account ID, or registry alias, associated with the
// public registry that contains the image layers to check. If you do not specify a
// registry, the default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -57,8 +57,8 @@ type BatchCheckLayerAvailabilityOutput struct {
// Any failures associated with the call.
Failures []types.LayerFailure
// A list of image layer objects corresponding to the image layer references in the
// request.
// A list of image layer objects that correspond to the image layer references in
// the request.
Layers []types.Layer
// Metadata pertaining to the operation's result.
@ -118,6 +118,9 @@ func (c *Client) addOperationBatchCheckLayerAvailabilityMiddlewares(stack *middl
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchCheckLayerAvailability(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -11,12 +11,12 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a list of specified images within a repository in a public registry.
// Images are specified with either an imageTag or imageDigest. You can remove a
// tag from an image by specifying the image's tag in your request. When you remove
// the last tag from an image, the image is deleted from your repository. You can
// completely delete an image (and all of its tags) by specifying the image's
// digest in your request.
// Deletes a list of specified images that are within a repository in a public
// registry. Images are specified with either an imageTag or imageDigest . You can
// remove a tag from an image by specifying the image's tag in your request. When
// you remove the last tag from an image, the image is deleted from your
// repository. You can completely delete an image (and all of its tags) by
// specifying the digest of the image in your request.
func (c *Client) BatchDeleteImage(ctx context.Context, params *BatchDeleteImageInput, optFns ...func(*Options)) (*BatchDeleteImageOutput, error) {
if params == nil {
params = &BatchDeleteImageInput{}
@ -34,8 +34,8 @@ func (c *Client) BatchDeleteImage(ctx context.Context, params *BatchDeleteImageI
type BatchDeleteImageInput struct {
// A list of image ID references that correspond to images to delete. The format of
// the imageIds reference is imageTag=tag or imageDigest=digest.
// A list of image ID references that correspond to images to delete. The format
// of the imageIds reference is imageTag=tag or imageDigest=digest .
//
// This member is required.
ImageIds []types.ImageIdentifier
@ -45,9 +45,9 @@ type BatchDeleteImageInput struct {
// This member is required.
RepositoryName *string
// The AWS account ID associated with the registry that contains the image to
// delete. If you do not specify a registry, the default public registry is
// assumed.
// The Amazon Web Services account ID, or registry alias, that's associated with
// the registry that contains the image to delete. If you do not specify a
// registry, the default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -118,6 +118,9 @@ func (c *Client) addOperationBatchDeleteImageMiddlewares(stack *middleware.Stack
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBatchDeleteImage(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -10,11 +10,11 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Informs Amazon ECR that the image layer upload has completed for a specified
// Informs Amazon ECR that the image layer upload is complete for a specified
// public registry, repository name, and upload ID. You can optionally provide a
// sha256 digest of the image layer for data validation purposes. When an image is
// pushed, the CompleteLayerUpload API is called once per each new image layer to
// verify that the upload has completed. This operation is used by the Amazon ECR
// pushed, the CompleteLayerUpload API is called once for each new image layer to
// verify that the upload is complete. This operation is used by the Amazon ECR
// proxy and is not generally used by customers for pulling and pushing images. In
// most cases, you should use the docker CLI to pull, tag, and push images.
func (c *Client) CompleteLayerUpload(ctx context.Context, params *CompleteLayerUploadInput, optFns ...func(*Options)) (*CompleteLayerUploadOutput, error) {
@ -51,8 +51,9 @@ type CompleteLayerUploadInput struct {
// This member is required.
UploadId *string
// The AWS account ID associated with the registry to which to upload layers. If
// you do not specify a registry, the default public registry is assumed.
// The Amazon Web Services account ID, or registry alias, associated with the
// registry where layers are uploaded. If you do not specify a registry, the
// default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -63,13 +64,13 @@ type CompleteLayerUploadOutput struct {
// The sha256 digest of the image layer.
LayerDigest *string
// The public registry ID associated with the request.
// The public registry ID that's associated with the request.
RegistryId *string
// The repository name associated with the request.
// The repository name that's associated with the request.
RepositoryName *string
// The upload ID associated with the layer.
// The upload ID that's associated with the layer.
UploadId *string
// Metadata pertaining to the operation's result.
@ -129,6 +130,9 @@ func (c *Client) addOperationCompleteLayerUploadMiddlewares(stack *middleware.St
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCompleteLayerUpload(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -12,9 +12,8 @@ import (
)
// Creates a repository in a public registry. For more information, see Amazon ECR
// repositories
// (https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html) in
// the Amazon Elastic Container Registry User Guide.
// repositories (https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html)
// in the Amazon Elastic Container Registry User Guide.
func (c *Client) CreateRepository(ctx context.Context, params *CreateRepositoryInput, optFns ...func(*Options)) (*CreateRepositoryOutput, error) {
if params == nil {
params = &CreateRepositoryInput{}
@ -33,9 +32,9 @@ func (c *Client) CreateRepository(ctx context.Context, params *CreateRepositoryI
type CreateRepositoryInput struct {
// The name to use for the repository. This appears publicly in the Amazon ECR
// Public Gallery. The repository name may be specified on its own (such as
// nginx-web-app) or it can be prepended with a namespace to group the repository
// into a category (such as project-a/nginx-web-app).
// Public Gallery. The repository name can be specified on its own (for example
// nginx-web-app ) or prepended with a namespace to group the repository into a
// category (for example project-a/nginx-web-app ).
//
// This member is required.
RepositoryName *string
@ -44,10 +43,10 @@ type CreateRepositoryInput struct {
// Public Gallery.
CatalogData *types.RepositoryCatalogDataInput
// The metadata that you apply to the repository to help you categorize and
// organize them. Each tag consists of a key and an optional value, both of which
// you define. Tag keys can have a maximum character length of 128 characters, and
// tag values can have a maximum length of 256 characters.
// The metadata that you apply to each repository to help categorize and organize
// your repositories. Each tag consists of a key and an optional value. You define
// both of them. Tag keys can have a maximum character length of 128 characters,
// and tag values can have a maximum length of 256 characters.
Tags []types.Tag
noSmithyDocumentSerde
@ -119,6 +118,9 @@ func (c *Client) addOperationCreateRepositoryMiddlewares(stack *middleware.Stack
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateRepository(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -12,8 +12,9 @@ import (
)
// Deletes a repository in a public registry. If the repository contains images,
// you must either delete all images in the repository or use the force option
// which deletes all images on your behalf before deleting the repository.
// you must either manually delete all images in the repository or use the force
// option. This option deletes all images on your behalf before deleting the
// repository.
func (c *Client) DeleteRepository(ctx context.Context, params *DeleteRepositoryInput, optFns ...func(*Options)) (*DeleteRepositoryOutput, error) {
if params == nil {
params = &DeleteRepositoryInput{}
@ -36,12 +37,13 @@ type DeleteRepositoryInput struct {
// This member is required.
RepositoryName *string
// If a repository contains images, forces the deletion.
// The force option can be used to delete a repository that contains images. If
// the force option is not used, the repository must be empty prior to deletion.
Force bool
// The AWS account ID associated with the public registry that contains the
// repository to delete. If you do not specify a registry, the default public
// registry is assumed.
// The Amazon Web Services account ID that's associated with the public registry
// that contains the repository to delete. If you do not specify a registry, the
// default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -109,6 +111,9 @@ func (c *Client) addOperationDeleteRepositoryMiddlewares(stack *middleware.Stack
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRepository(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -10,7 +10,7 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the repository policy associated with the specified repository.
// Deletes the repository policy that's associated with the specified repository.
func (c *Client) DeleteRepositoryPolicy(ctx context.Context, params *DeleteRepositoryPolicyInput, optFns ...func(*Options)) (*DeleteRepositoryPolicyOutput, error) {
if params == nil {
params = &DeleteRepositoryPolicyInput{}
@ -28,15 +28,15 @@ func (c *Client) DeleteRepositoryPolicy(ctx context.Context, params *DeleteRepos
type DeleteRepositoryPolicyInput struct {
// The name of the repository that is associated with the repository policy to
// The name of the repository that's associated with the repository policy to
// delete.
//
// This member is required.
RepositoryName *string
// The AWS account ID associated with the public registry that contains the
// repository policy to delete. If you do not specify a registry, the default
// public registry is assumed.
// The Amazon Web Services account ID that's associated with the public registry
// that contains the repository policy to delete. If you do not specify a registry,
// the default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -47,10 +47,10 @@ type DeleteRepositoryPolicyOutput struct {
// The JSON repository policy that was deleted from the repository.
PolicyText *string
// The registry ID associated with the request.
// The registry ID that's associated with the request.
RegistryId *string
// The repository name associated with the request.
// The repository name that's associated with the request.
RepositoryName *string
// Metadata pertaining to the operation's result.
@ -110,6 +110,9 @@ func (c *Client) addOperationDeleteRepositoryPolicyMiddlewares(stack *middleware
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRepositoryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -35,26 +35,26 @@ type DescribeImageTagsInput struct {
// This member is required.
RepositoryName *string
// The maximum number of repository results returned by DescribeImageTags in
// paginated output. When this parameter is used, DescribeImageTags only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeImageTags request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter is not used, then DescribeImageTags
// returns up to 100 results and a nextToken value, if applicable. This option
// cannot be used when you specify images with imageIds.
// The maximum number of repository results that's returned by DescribeImageTags
// in paginated output. When this parameter is used, DescribeImageTags only
// returns maxResults results in a single page along with a nextToken response
// element. You can see the remaining results of the initial request by sending
// another DescribeImageTags request with the returned nextToken value. This value
// can be between 1 and 1000. If this parameter isn't used, then DescribeImageTags
// returns up to 100 results and a nextToken value, if applicable. If you specify
// images with imageIds , you can't use this option.
MaxResults *int32
// The nextToken value returned from a previous paginated DescribeImageTags request
// where maxResults was used and the results exceeded the value of that parameter.
// Pagination continues from the end of the previous results that returned the
// nextToken value. This value is null when there are no more results to return.
// This option cannot be used when you specify images with imageIds.
// The nextToken value that's returned from a previous paginated DescribeImageTags
// request where maxResults was used and the results exceeded the value of that
// parameter. Pagination continues from the end of the previous results that
// returned the nextToken value. If there are no more results to return, this
// value is null . If you specify images with imageIds , you can't use this option.
NextToken *string
// The AWS account ID associated with the public registry that contains the
// repository in which to describe images. If you do not specify a registry, the
// default public registry is assumed.
// The Amazon Web Services account ID that's associated with the public registry
// that contains the repository where images are described. If you do not specify a
// registry, the default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -66,9 +66,9 @@ type DescribeImageTagsOutput struct {
ImageTagDetails []types.ImageTagDetail
// The nextToken value to include in a future DescribeImageTags request. When the
// results of a DescribeImageTags request exceed maxResults, this value can be used
// to retrieve the next page of results. This value is null when there are no more
// results to return.
// results of a DescribeImageTags request exceed maxResults , you can use this
// value to retrieve the next page of results. If there are no more results to
// return, this value is null .
NextToken *string
// Metadata pertaining to the operation's result.
@ -128,6 +128,9 @@ func (c *Client) addOperationDescribeImageTagsMiddlewares(stack *middleware.Stac
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeImageTags(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -150,14 +153,14 @@ var _ DescribeImageTagsAPIClient = (*Client)(nil)
// DescribeImageTagsPaginatorOptions is the paginator options for DescribeImageTags
type DescribeImageTagsPaginatorOptions struct {
// The maximum number of repository results returned by DescribeImageTags in
// paginated output. When this parameter is used, DescribeImageTags only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeImageTags request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter is not used, then DescribeImageTags
// returns up to 100 results and a nextToken value, if applicable. This option
// cannot be used when you specify images with imageIds.
// The maximum number of repository results that's returned by DescribeImageTags
// in paginated output. When this parameter is used, DescribeImageTags only
// returns maxResults results in a single page along with a nextToken response
// element. You can see the remaining results of the initial request by sending
// another DescribeImageTags request with the returned nextToken value. This value
// can be between 1 and 1000. If this parameter isn't used, then DescribeImageTags
// returns up to 100 results and a nextToken value, if applicable. If you specify
// images with imageIds , you can't use this option.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token

View File

@ -12,11 +12,11 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns metadata about the images in a repository in a public registry.
// Beginning with Docker version 1.9, the Docker client compresses image layers
// before pushing them to a V2 Docker registry. The output of the docker images
// command shows the uncompressed image size, so it may return a larger image size
// than the image sizes returned by DescribeImages.
// Returns metadata that's related to the images in a repository in a public
// registry. Beginning with Docker version 1.9, the Docker client compresses image
// layers before pushing them to a V2 Docker registry. The output of the docker
// images command shows the uncompressed image size. Therefore, it might return a
// larger image size than the image sizes that are returned by DescribeImages .
func (c *Client) DescribeImages(ctx context.Context, params *DescribeImagesInput, optFns ...func(*Options)) (*DescribeImagesOutput, error) {
if params == nil {
params = &DescribeImagesInput{}
@ -42,26 +42,26 @@ type DescribeImagesInput struct {
// The list of image IDs for the requested repository.
ImageIds []types.ImageIdentifier
// The maximum number of repository results returned by DescribeImages in paginated
// output. When this parameter is used, DescribeImages only returns maxResults
// results in a single page along with a nextToken response element. The remaining
// results of the initial request can be seen by sending another DescribeImages
// request with the returned nextToken value. This value can be between 1 and 1000.
// If this parameter is not used, then DescribeImages returns up to 100 results and
// a nextToken value, if applicable. This option cannot be used when you specify
// images with imageIds.
// The maximum number of repository results that's returned by DescribeImages in
// paginated output. When this parameter is used, DescribeImages only returns
// maxResults results in a single page along with a nextToken response element.
// You can see the remaining results of the initial request by sending another
// DescribeImages request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter isn't used, then DescribeImages returns
// up to 100 results and a nextToken value, if applicable. If you specify images
// with imageIds , you can't use this option.
MaxResults *int32
// The nextToken value returned from a previous paginated DescribeImages request
// where maxResults was used and the results exceeded the value of that parameter.
// Pagination continues from the end of the previous results that returned the
// nextToken value. This value is null when there are no more results to return.
// This option cannot be used when you specify images with imageIds.
// The nextToken value that's returned from a previous paginated DescribeImages
// request where maxResults was used and the results exceeded the value of that
// parameter. Pagination continues from the end of the previous results that
// returned the nextToken value. If there are no more results to return, this
// value is null . If you specify images with imageIds , you can't use this option.
NextToken *string
// The AWS account ID associated with the public registry that contains the
// repository in which to describe images. If you do not specify a registry, the
// default public registry is assumed.
// The Amazon Web Services account ID that's associated with the public registry
// that contains the repository where images are described. If you do not specify a
// registry, the default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -73,9 +73,9 @@ type DescribeImagesOutput struct {
ImageDetails []types.ImageDetail
// The nextToken value to include in a future DescribeImages request. When the
// results of a DescribeImages request exceed maxResults, this value can be used to
// retrieve the next page of results. This value is null when there are no more
// results to return.
// results of a DescribeImages request exceed maxResults , you can use this value
// to retrieve the next page of results. If there are no more results to return,
// this value is null .
NextToken *string
// Metadata pertaining to the operation's result.
@ -135,6 +135,9 @@ func (c *Client) addOperationDescribeImagesMiddlewares(stack *middleware.Stack,
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeImages(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -157,14 +160,14 @@ var _ DescribeImagesAPIClient = (*Client)(nil)
// DescribeImagesPaginatorOptions is the paginator options for DescribeImages
type DescribeImagesPaginatorOptions struct {
// The maximum number of repository results returned by DescribeImages in paginated
// output. When this parameter is used, DescribeImages only returns maxResults
// results in a single page along with a nextToken response element. The remaining
// results of the initial request can be seen by sending another DescribeImages
// request with the returned nextToken value. This value can be between 1 and 1000.
// If this parameter is not used, then DescribeImages returns up to 100 results and
// a nextToken value, if applicable. This option cannot be used when you specify
// images with imageIds.
// The maximum number of repository results that's returned by DescribeImages in
// paginated output. When this parameter is used, DescribeImages only returns
// maxResults results in a single page along with a nextToken response element.
// You can see the remaining results of the initial request by sending another
// DescribeImages request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter isn't used, then DescribeImages returns
// up to 100 results and a nextToken value, if applicable. If you specify images
// with imageIds , you can't use this option.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token

View File

@ -30,21 +30,22 @@ func (c *Client) DescribeRegistries(ctx context.Context, params *DescribeRegistr
type DescribeRegistriesInput struct {
// The maximum number of repository results returned by DescribeRegistries in
// paginated output. When this parameter is used, DescribeRegistries only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeRegistries request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter is not used, then DescribeRegistries
// returns up to 100 results and a nextToken value, if applicable.
// The maximum number of repository results that's returned by DescribeRegistries
// in paginated output. When this parameter is used, DescribeRegistries only
// returns maxResults results in a single page along with a nextToken response
// element. The remaining results of the initial request can be seen by sending
// another DescribeRegistries request with the returned nextToken value. This
// value can be between 1 and 1000. If this parameter isn't used, then
// DescribeRegistries returns up to 100 results and a nextToken value, if
// applicable.
MaxResults *int32
// The nextToken value returned from a previous paginated DescribeRegistries
// The nextToken value that's returned from a previous paginated DescribeRegistries
// request where maxResults was used and the results exceeded the value of that
// parameter. Pagination continues from the end of the previous results that
// returned the nextToken value. This value is null when there are no more results
// to return. This token should be treated as an opaque identifier that is only
// used to retrieve the next items in a list and not for other programmatic
// returned the nextToken value. If there are no more results to return, this
// value is null . This token should be treated as an opaque identifier that is
// only used to retrieve the next items in a list and not for other programmatic
// purposes.
NextToken *string
@ -53,15 +54,15 @@ type DescribeRegistriesInput struct {
type DescribeRegistriesOutput struct {
// An object containing the details for a public registry.
// An object that contains the details for a public registry.
//
// This member is required.
Registries []types.Registry
// The nextToken value to include in a future DescribeRepositories request. When
// the results of a DescribeRepositories request exceed maxResults, this value can
// be used to retrieve the next page of results. This value is null when there are
// no more results to return.
// The nextToken value to include in a future DescribeRepositories request. If the
// results of a DescribeRepositories request exceed maxResults , you can use this
// value to retrieve the next page of results. If there are no more results, this
// value is null .
NextToken *string
// Metadata pertaining to the operation's result.
@ -118,6 +119,9 @@ func (c *Client) addOperationDescribeRegistriesMiddlewares(stack *middleware.Sta
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeRegistries(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -141,13 +145,14 @@ var _ DescribeRegistriesAPIClient = (*Client)(nil)
// DescribeRegistriesPaginatorOptions is the paginator options for
// DescribeRegistries
type DescribeRegistriesPaginatorOptions struct {
// The maximum number of repository results returned by DescribeRegistries in
// paginated output. When this parameter is used, DescribeRegistries only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeRegistries request with the returned nextToken value. This value can be
// between 1 and 1000. If this parameter is not used, then DescribeRegistries
// returns up to 100 results and a nextToken value, if applicable.
// The maximum number of repository results that's returned by DescribeRegistries
// in paginated output. When this parameter is used, DescribeRegistries only
// returns maxResults results in a single page along with a nextToken response
// element. The remaining results of the initial request can be seen by sending
// another DescribeRegistries request with the returned nextToken value. This
// value can be between 1 and 1000. If this parameter isn't used, then
// DescribeRegistries returns up to 100 results and a nextToken value, if
// applicable.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token

View File

@ -12,7 +12,7 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Describes repositories in a public registry.
// Describes repositories that are in a public registry.
func (c *Client) DescribeRepositories(ctx context.Context, params *DescribeRepositoriesInput, optFns ...func(*Options)) (*DescribeRepositoriesOutput, error) {
if params == nil {
params = &DescribeRepositoriesInput{}
@ -30,29 +30,30 @@ func (c *Client) DescribeRepositories(ctx context.Context, params *DescribeRepos
type DescribeRepositoriesInput struct {
// The maximum number of repository results returned by DescribeRepositories in
// paginated output. When this parameter is used, DescribeRepositories only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeRepositories request with the returned nextToken value. This value can
// be between 1 and 1000. If this parameter is not used, then DescribeRepositories
// returns up to 100 results and a nextToken value, if applicable. This option
// cannot be used when you specify repositories with repositoryNames.
// The maximum number of repository results that's returned by DescribeRepositories
// in paginated output. When this parameter is used, DescribeRepositories only
// returns maxResults results in a single page along with a nextToken response
// element. You can see the remaining results of the initial request by sending
// another DescribeRepositories request with the returned nextToken value. This
// value can be between 1 and 1000. If this parameter isn't used, then
// DescribeRepositories returns up to 100 results and a nextToken value, if
// applicable. If you specify repositories with repositoryNames , you can't use
// this option.
MaxResults *int32
// The nextToken value returned from a previous paginated DescribeRepositories
// request where maxResults was used and the results exceeded the value of that
// parameter. Pagination continues from the end of the previous results that
// returned the nextToken value. This value is null when there are no more results
// to return. This option cannot be used when you specify repositories with
// repositoryNames. This token should be treated as an opaque identifier that is
// only used to retrieve the next items in a list and not for other programmatic
// purposes.
// The nextToken value that's returned from a previous paginated
// DescribeRepositories request where maxResults was used and the results exceeded
// the value of that parameter. Pagination continues from the end of the previous
// results that returned the nextToken value. If there are no more results to
// return, this value is null . If you specify repositories with repositoryNames ,
// you can't use this option. This token should be treated as an opaque identifier
// that is only used to retrieve the next items in a list and not for other
// programmatic purposes.
NextToken *string
// The AWS account ID associated with the registry that contains the repositories
// to be described. If you do not specify a registry, the default public registry
// is assumed.
// The Amazon Web Services account ID that's associated with the registry that
// contains the repositories to be described. If you do not specify a registry, the
// default public registry is assumed.
RegistryId *string
// A list of repositories to describe. If this parameter is omitted, then all
@ -65,9 +66,9 @@ type DescribeRepositoriesInput struct {
type DescribeRepositoriesOutput struct {
// The nextToken value to include in a future DescribeRepositories request. When
// the results of a DescribeRepositories request exceed maxResults, this value can
// be used to retrieve the next page of results. This value is null when there are
// no more results to return.
// the results of a DescribeRepositories request exceed maxResults , this value can
// be used to retrieve the next page of results. If there are no more results to
// return, this value is null .
NextToken *string
// A list of repository objects corresponding to valid repositories.
@ -127,6 +128,9 @@ func (c *Client) addOperationDescribeRepositoriesMiddlewares(stack *middleware.S
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeRepositories(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -150,14 +154,15 @@ var _ DescribeRepositoriesAPIClient = (*Client)(nil)
// DescribeRepositoriesPaginatorOptions is the paginator options for
// DescribeRepositories
type DescribeRepositoriesPaginatorOptions struct {
// The maximum number of repository results returned by DescribeRepositories in
// paginated output. When this parameter is used, DescribeRepositories only returns
// maxResults results in a single page along with a nextToken response element. The
// remaining results of the initial request can be seen by sending another
// DescribeRepositories request with the returned nextToken value. This value can
// be between 1 and 1000. If this parameter is not used, then DescribeRepositories
// returns up to 100 results and a nextToken value, if applicable. This option
// cannot be used when you specify repositories with repositoryNames.
// The maximum number of repository results that's returned by DescribeRepositories
// in paginated output. When this parameter is used, DescribeRepositories only
// returns maxResults results in a single page along with a nextToken response
// element. You can see the remaining results of the initial request by sending
// another DescribeRepositories request with the returned nextToken value. This
// value can be between 1 and 1000. If this parameter isn't used, then
// DescribeRepositories returns up to 100 results and a nextToken value, if
// applicable. If you specify repositories with repositoryNames , you can't use
// this option.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token

View File

@ -12,7 +12,7 @@ import (
)
// Retrieves an authorization token. An authorization token represents your IAM
// authentication credentials and can be used to access any Amazon ECR registry
// authentication credentials. You can use it to access any Amazon ECR registry
// that your IAM principal has access to. The authorization token is valid for 12
// hours. This API requires the ecr-public:GetAuthorizationToken and
// sts:GetServiceBearerToken permissions.
@ -94,6 +94,9 @@ func (c *Client) addOperationGetAuthorizationTokenMiddlewares(stack *middleware.
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAuthorizationToken(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -92,6 +92,9 @@ func (c *Client) addOperationGetRegistryCatalogDataMiddlewares(stack *middleware
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRegistryCatalogData(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -35,9 +35,9 @@ type GetRepositoryCatalogDataInput struct {
// This member is required.
RepositoryName *string
// The AWS account ID associated with the registry that contains the repositories
// to be described. If you do not specify a registry, the default public registry
// is assumed.
// The Amazon Web Services account ID that's associated with the registry that
// contains the repositories to be described. If you do not specify a registry, the
// default public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -105,6 +105,9 @@ func (c *Client) addOperationGetRepositoryCatalogDataMiddlewares(stack *middlewa
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRepositoryCatalogData(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

View File

@ -33,9 +33,9 @@ type GetRepositoryPolicyInput struct {
// This member is required.
RepositoryName *string
// The AWS account ID associated with the public registry that contains the
// repository. If you do not specify a registry, the default public registry is
// assumed.
// The Amazon Web Services account ID that's associated with the public registry
// that contains the repository. If you do not specify a registry, the default
// public registry is assumed.
RegistryId *string
noSmithyDocumentSerde
@ -43,14 +43,14 @@ type GetRepositoryPolicyInput struct {
type GetRepositoryPolicyOutput struct {
// The repository policy text associated with the repository. The policy text will
// be in JSON format.
// The repository policy text that's associated with the repository. The policy
// text will be in JSON format.
PolicyText *string
// The registry ID associated with the request.
// The registry ID that's associated with the request.
RegistryId *string
// The repository name associated with the request.
// The repository name that's associated with the request.
RepositoryName *string
// Metadata pertaining to the operation's result.
@ -110,6 +110,9 @@ func (c *Client) addOperationGetRepositoryPolicyMiddlewares(stack *middleware.St
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRepositoryPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}

Some files were not shown because too many files have changed in this diff Show More